mirror of
https://github.com/bdnugget/freeminer.git
synced 2026-11-07 06:57:27 +00:00
earth, fixes
This commit is contained in:
1 parent
41986e87b9
commit
9fe3333da5
11 files changed
+73
-63
No files matched your search
@@ -119,34 +119,36 @@ if(NOT MSVC)
|
||||
|
||||
if("${CMAKE_GENERATOR}" STREQUAL "Ninja" )
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -fdiagnostics-color")
|
||||
add_compile_options(-fdiagnostics-color)
|
||||
elseif ( CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.8 )
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -fdiagnostics-color=always")
|
||||
add_compile_options(-fdiagnostics-color=always)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if(SANITIZE_ADDRESS)
|
||||
message(STATUS "Build with sanitize=address")
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
set(ENABLE_SYSTEM_JSONCPP 0)
|
||||
add_compile_options(-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls)
|
||||
add_link_options(-fsanitize=address)
|
||||
set(ENABLE_SYSTEM_JSONCPP 0)
|
||||
endif()
|
||||
if(SANITIZE_THREAD)
|
||||
message(STATUS "Build with sanitize=thread")
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -fsanitize=thread -fPIE -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
add_compile_options(-fsanitize=thread -fPIE -fno-omit-frame-pointer -fno-optimize-sibling-calls)
|
||||
add_link_options(-fsanitize=thread -fPIE)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -pie")
|
||||
add_compile_options(-pie)
|
||||
endif()
|
||||
set(ENABLE_SYSTEM_JSONCPP 0)
|
||||
endif()
|
||||
if(SANITIZE_MEMORY)
|
||||
message(STATUS "Build with sanitize=memory")
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -fsanitize=memory -fPIE -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
|
||||
add_compile_options(-fsanitize=memory -fPIE -fno-omit-frame-pointer -fno-optimize-sibling-calls)
|
||||
add_link_options(-fsanitize=memory -pie)
|
||||
set(ENABLE_SYSTEM_JSONCPP 0)
|
||||
endif()
|
||||
if(SANITIZE_UNDEFINED)
|
||||
message(STATUS "Build with sanitize=undefined ")
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls)
|
||||
add_link_options(-fsanitize=undefined)
|
||||
set(ENABLE_SYSTEM_JSONCPP 0)
|
||||
endif()
|
||||
|
||||
@@ -182,7 +184,7 @@ if(NOT MSVC)
|
||||
|
||||
if (TCMALLOC_LIBRARY)
|
||||
set(PLATFORM_LIBS ${PLATFORM_LIBS} ${TCMALLOC_LIBRARY})
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
|
||||
add_compile_options(-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free)
|
||||
endif()
|
||||
|
||||
message(STATUS "Build with tcmalloc ${TCMALLOC_LIBRARY} ${PROFILER_LIBRARY}")
|
||||
|
||||
@@ -368,6 +368,7 @@ void Client::Stop()
|
||||
// TODO: correct order:
|
||||
mesh_thread_pool.wait_until_empty();
|
||||
farmesh_async.wait();
|
||||
mesh_thread_pool.wait_until_nothing_in_flight();
|
||||
mesh_thread_pool.wait_until_empty();
|
||||
farmesh.reset();
|
||||
farmesh_async.wait();
|
||||
@@ -396,6 +397,7 @@ Client::~Client()
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
}
|
||||
mesh_thread_pool.wait_until_nothing_in_flight();
|
||||
mesh_thread_pool.wait_until_empty(); // before ~ClientMap()
|
||||
|
||||
deleteAuthData();
|
||||
@@ -407,6 +409,9 @@ Client::~Client()
|
||||
updateDrawList_async.wait();
|
||||
update_shadows_async.wait();
|
||||
|
||||
mesh_thread_pool.wait_until_nothing_in_flight();
|
||||
mesh_thread_pool.wait_until_empty(); // before ~ClientMap()
|
||||
|
||||
/*
|
||||
MeshUpdateResult r;
|
||||
while (m_mesh_update_manager->getNextResult(r)) {
|
||||
|
||||
+33
-30
@@ -203,39 +203,42 @@ void Client::handleCommand_BlockDataFm(NetworkPacket *pkt)
|
||||
if (!block)
|
||||
block = m_env.getMap().createBlankBlock(bpos);
|
||||
}
|
||||
const auto lock = block->lock_unique_rec();
|
||||
block->far_step = step;
|
||||
content_t content_only{};
|
||||
packet.convert_safe(TOCLIENT_BLOCKDATA_CONTENT_ONLY, content_only);
|
||||
block->content_only = content_only;
|
||||
packet.convert_safe(
|
||||
TOCLIENT_BLOCKDATA_CONTENT_ONLY_PARAM1, block->content_only_param1);
|
||||
packet.convert_safe(
|
||||
TOCLIENT_BLOCKDATA_CONTENT_ONLY_PARAM2, block->content_only_param2);
|
||||
{
|
||||
const auto lock = block->lock_unique_rec();
|
||||
block->far_step = step;
|
||||
content_t content_only{};
|
||||
packet.convert_safe(TOCLIENT_BLOCKDATA_CONTENT_ONLY, content_only);
|
||||
block->content_only = content_only;
|
||||
packet.convert_safe(
|
||||
TOCLIENT_BLOCKDATA_CONTENT_ONLY_PARAM1, block->content_only_param1);
|
||||
packet.convert_safe(
|
||||
TOCLIENT_BLOCKDATA_CONTENT_ONLY_PARAM2, block->content_only_param2);
|
||||
|
||||
if (block->content_only == CONTENT_IGNORE) {
|
||||
try {
|
||||
block->deSerialize(istr, m_server_ser_ver, false);
|
||||
} catch (const std::exception &ex) {
|
||||
errorstream << "fm block deSerialize fail " << bpos << " " << block->far_step
|
||||
<< " : " << ex.what() << " : " << pkt->getSize() << " "
|
||||
<< packet.size() << " v=" << (short)m_server_ser_ver << "\n";
|
||||
if (block->content_only == CONTENT_IGNORE) {
|
||||
try {
|
||||
block->deSerialize(istr, m_server_ser_ver, false);
|
||||
} catch (const std::exception &ex) {
|
||||
errorstream << "fm block deSerialize fail " << bpos << " "
|
||||
<< block->far_step << " : " << ex.what() << " : "
|
||||
<< pkt->getSize() << " " << packet.size()
|
||||
<< " v=" << (short)m_server_ser_ver << "\n";
|
||||
#if !NDEBUG
|
||||
errorstream << "bad data " << istr.str().size() << " : " << istr.str()
|
||||
<< "\n";
|
||||
errorstream << "bad data " << istr.str().size() << " : " << istr.str()
|
||||
<< "\n";
|
||||
#endif
|
||||
return;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
block->fill({block->content_only, block->content_only_param1,
|
||||
block->content_only_param2});
|
||||
}
|
||||
} else {
|
||||
block->fill({block->content_only, block->content_only_param1,
|
||||
block->content_only_param2});
|
||||
s32 h = 0; // for convert to atomic
|
||||
packet[TOCLIENT_BLOCKDATA_HEAT].convert(h);
|
||||
block->heat = h;
|
||||
h = 0;
|
||||
packet[TOCLIENT_BLOCKDATA_HUMIDITY].convert(h);
|
||||
block->humidity = h;
|
||||
}
|
||||
s32 h = 0; // for convert to atomic
|
||||
packet[TOCLIENT_BLOCKDATA_HEAT].convert(h);
|
||||
block->heat = h;
|
||||
h = 0;
|
||||
packet[TOCLIENT_BLOCKDATA_HUMIDITY].convert(h);
|
||||
block->humidity = h;
|
||||
|
||||
if (m_localdb && !is_simple_singleplayer_game) {
|
||||
if (const auto db = GetFarDatabase({}, far_dbases, m_world_path, step); db) {
|
||||
@@ -253,7 +256,7 @@ void Client::handleCommand_BlockDataFm(NetworkPacket *pkt)
|
||||
block->content_only != CONTENT_AIR) {
|
||||
if (getNodeBlockPos(floatToInt(m_env.getLocalPlayer()->getPosition(), BS))
|
||||
.getDistanceFrom(bpos) <= 1)
|
||||
addUpdateMeshTaskWithEdge(bpos);
|
||||
addUpdateMeshTaskWithEdge(bpos);
|
||||
}
|
||||
} else {
|
||||
static thread_local const auto settings_farmesh_server =
|
||||
@@ -290,7 +293,7 @@ void Client::handleCommand_BlockDataFm(NetworkPacket *pkt)
|
||||
}
|
||||
createFarMesh(block);
|
||||
auto &far_blocks = client_map.m_far_blocks;
|
||||
|
||||
|
||||
const auto lock = far_blocks.lock_unique_rec();
|
||||
if (const auto &it = far_blocks.find(bpos); it != far_blocks.end()) {
|
||||
if (it->second->far_step != block->far_step) {
|
||||
|
||||
+1
-1
@@ -939,7 +939,7 @@ void Hud::drawBlockBounds()
|
||||
|
||||
u16 mesh_chunk_size = std::max<u16>(1, g_settings->getU16("client_mesh_chunk"));
|
||||
|
||||
v3s16 pos = player->getStandingNodePos();
|
||||
// 3s16 pos = player->getStandingNodePos();
|
||||
|
||||
if (m_block_bounds_mode == BLOCK_BOUNDS_FAR_DRAWN) {
|
||||
const auto offset = intToFloat(client->getCamera()->getOffset(), BS);
|
||||
|
||||
@@ -36,7 +36,7 @@ void FpsControl::reset()
|
||||
|
||||
void FpsControl::limit(IrrlichtDevice *device, f32 *dtime)
|
||||
{
|
||||
const float fps_limit = device->isWindowFocused()
|
||||
static thread_local const float fps_limit = device->isWindowFocused()
|
||||
? g_settings->getFloat("fps_max")
|
||||
: g_settings->getFloat("fps_max_unfocused");
|
||||
const u64 frametime_min = 1000000.0f / std::max(fps_limit, 1.0f);
|
||||
@@ -312,7 +312,7 @@ void RenderingEngine::draw_load_screen(const std::wstring &text,
|
||||
|
||||
driver->setFog(RenderingEngine::MENU_SKY_COLOR);
|
||||
driver->beginScene(true, true, RenderingEngine::MENU_SKY_COLOR);
|
||||
if (g_settings->getBool("menu_clouds")) {
|
||||
if (static thread_local const auto menu_clouds = g_settings->getBool("menu_clouds"); menu_clouds) {
|
||||
g_menuclouds->step(dtime * 3);
|
||||
g_menucloudsmgr->drawAll();
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ void fm_set_default_settings(Settings *settings) {
|
||||
settings->setDefault("emergequeue_limit_diskonly", ""); // autodetect from number of cpus
|
||||
settings->setDefault("emergequeue_limit_generate", ""); // autodetect from number of cpus
|
||||
settings->setDefault("emergequeue_limit_total", ""); // autodetect from number of cpus
|
||||
// settings->setDefault("num_emerge_threads", ""); // "1" // Fix and enable auto
|
||||
settings->setDefault("num_emerge_threads", ""); // "1" // Fix and enable auto
|
||||
settings->setDefault("server_map_save_interval", "300"); // "5.3"
|
||||
settings->setDefault("sqlite_synchronous", "1"); // "2"
|
||||
settings->setDefault("save_generated_block", "true");
|
||||
|
||||
Submodule src/mapgen/earth/arnis-cpp updated: 211bbcc29e...7f1cba84aa.
@@ -183,11 +183,8 @@ public:
|
||||
|
||||
class MyHandler : public osmium::handler::Handler
|
||||
{
|
||||
MapgenEarth *mg;
|
||||
const bool todo{false};
|
||||
|
||||
public:
|
||||
MyHandler(MapgenEarth *mg) : mg{mg} {}
|
||||
MapgenEarth *mg{};
|
||||
|
||||
void way(const osmium::Way &way)
|
||||
{
|
||||
@@ -225,6 +222,9 @@ public:
|
||||
std::vector<arnis::ProcessedElement> v;
|
||||
for (const auto &r : relation) {
|
||||
}
|
||||
for (const auto &sn : relation.subitems<osmium::Way>()) {
|
||||
way(sn);
|
||||
}
|
||||
arnis::generate_world(editor, v);
|
||||
}
|
||||
};
|
||||
@@ -234,20 +234,19 @@ class hdl : public handler_i
|
||||
osmium::Location>;
|
||||
using cache_t = osmium::handler::NodeLocationsForWays<index_t>;
|
||||
|
||||
MapgenEarth *mg{};
|
||||
const std::string path_name;
|
||||
|
||||
MyHandler handler;
|
||||
|
||||
public:
|
||||
hdl(MapgenEarth *mg, const std::string &path_name) :
|
||||
mg{mg}, path_name{path_name}, handler{mg}
|
||||
path_name{path_name}
|
||||
{
|
||||
}
|
||||
|
||||
~hdl() = default;
|
||||
|
||||
void apply() override
|
||||
void apply(MapgenEarth *mg) override
|
||||
{
|
||||
osmium::area::Assembler::config_type assembler_config;
|
||||
assembler_config.create_empty_areas = false;
|
||||
@@ -260,7 +259,6 @@ public:
|
||||
{
|
||||
const auto llmin = mg->pos_to_ll(mg->node_min.X, mg->node_min.Z);
|
||||
const auto llmax = mg->pos_to_ll(mg->node_max.X, mg->node_max.Z);
|
||||
|
||||
}
|
||||
osmium::io::File file{path_name, "pbf"};
|
||||
osmium::relations::read_relations(file, mp_manager);
|
||||
@@ -272,6 +270,7 @@ public:
|
||||
}
|
||||
|
||||
arnis::init(mg);
|
||||
handler.mg = mg;
|
||||
osmium::apply(reader, cache, handler,
|
||||
mp_manager.handler([&handler = this->handler](
|
||||
const osmium::memory::Buffer &area_buffer) {
|
||||
|
||||
@@ -451,13 +451,13 @@ void MapgenEarth::generateBuildings()
|
||||
}
|
||||
|
||||
if (const auto &hdlr = maps_holder->osm_bbox.get(bbox)) {
|
||||
hdlr->apply();
|
||||
hdlr->apply(this);
|
||||
}
|
||||
|
||||
verbosestream << "Buildings stat: " << node_min << " set=" << stat.set
|
||||
<< " miss=" << stat.miss << " level=" << stat.level
|
||||
<< " check=" << stat.check << " fill=" << stat.fill << "\n";
|
||||
stat = {};
|
||||
stat.clean();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
@@ -64,7 +65,7 @@ class MapgenEarth;
|
||||
class handler_i
|
||||
{
|
||||
public:
|
||||
virtual void apply() = 0;
|
||||
virtual void apply(MapgenEarth*) = 0;
|
||||
};
|
||||
|
||||
struct maps_holder_t
|
||||
@@ -115,10 +116,11 @@ public:
|
||||
|
||||
struct Stat
|
||||
{
|
||||
int set{};
|
||||
int miss{};
|
||||
int level{};
|
||||
int check{};
|
||||
int fill{};
|
||||
std::atomic_int set{};
|
||||
std::atomic_int miss{};
|
||||
std::atomic_int level{};
|
||||
std::atomic_int check{};
|
||||
std::atomic_int fill{};
|
||||
void clean() { set = miss = level = check = fill = 0; }
|
||||
} stat;
|
||||
};
|
||||
@@ -330,7 +330,6 @@ int MapgenV7::getSpawnLevelAtPoint(v2s16 p)
|
||||
return MAX_MAP_GENERATION_LIMIT;
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::makeChunk(BlockMakeData *data)
|
||||
{
|
||||
// Pre-conditions
|
||||
|
||||
Reference in new issue
Block a user