Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/wip5.8.0' into wip5.8.0webport
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Oct 17, 2024
2 parents fe3257b + 56d9c82 commit a2bc601
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,8 +1067,7 @@ void Client::initLocalMapSaving(const Address &address,
m_localdb->beginSave();
actionstream << "Local map saving started, map will be saved at '" << world_path << "'" << std::endl;

{
far_world_path = world_path;
if (!m_simple_singleplayer_mode) {
far_dbases[0].reset(m_localdb, [](auto) {});
if (!merger) {
merger = std::make_unique<WorldMerger>(WorldMerger{
Expand All @@ -1080,7 +1079,7 @@ void Client::initLocalMapSaving(const Address &address,
.smap{&getEnv().getClientMap()},
.far_dbases{far_dbases},
.dbase{m_localdb},
.save_dir{far_world_path},
.save_dir{m_world_path},
});
}
}
Expand Down
1 change: 0 additions & 1 deletion src/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
ChatBackend *chat_backend {};
FarContainer far_container;
ServerMap::far_dbases_t far_dbases;
std::string far_world_path;
std::unique_ptr<WorldMerger> merger;
// ==

Expand Down
7 changes: 2 additions & 5 deletions src/client/fm_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ void Client::MakeEmerge(const Settings &settings, const MapgenType &mgtype)
m_settings_mgr = std::make_unique<MapSettingsManager>(
m_world_path + DIR_DELIM + "map_meta");
m_settings_mgr->mapgen_params = m_mapgen_params.release();
;
m_settings_mgr->saveMapMeta();
} else if (!m_emerge) {
m_mapgen_params.reset();
Expand Down Expand Up @@ -230,10 +229,8 @@ void Client::handleCommand_BlockDataFm(NetworkPacket *pkt)
packet[TOCLIENT_BLOCKDATA_HUMIDITY].convert(h);
block->humidity = h;

if (m_localdb
//&& !is_simple_singleplayer_game
) {
if (const auto db = GetFarDatabase({}, far_dbases, far_world_path, step); db) {
if (m_localdb && !is_simple_singleplayer_game) {
if (const auto db = GetFarDatabase({}, far_dbases, m_world_path, step); db) {
ServerMap::saveBlock(block.get(), db);

if (!step) {
Expand Down
2 changes: 1 addition & 1 deletion src/client/fm_far_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const MapNode &FarContainer::getNodeRefUnsafe(const v3pos_t &pos)

const auto loadBlock = [this](const auto &bpos, const auto step) -> MapBlockP {
auto *dbase =
GetFarDatabase({}, m_client->far_dbases, m_client->far_world_path, step);
GetFarDatabase({}, m_client->far_dbases, m_client->m_world_path, step);
if (!dbase) {
return {};
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/fm_farmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ FarMesh::FarMesh(Client *client, Server *server, MapDrawControl *control) :
MapgenType mgtype = FARMESH_DEFAULT_MAPGEN;
settings.set("mg_name", Mapgen::getMapgenName(mgtype));
m_client->MakeEmerge(settings, mgtype);
emerge_use = m_client->m_emerge.get();
}
emerge_use = m_client->m_emerge.get();

if (emerge_use) {
if (emerge_use->mgparams) {
Expand Down
2 changes: 1 addition & 1 deletion src/network/clientpackethandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void Client::handleCommand_BlockData(NetworkPacket* pkt)
++m_new_meshes;
}

if (m_localdb) {
if (m_localdb && !is_simple_singleplayer_game) {
ServerMap::saveBlock(block, m_localdb);
merger->add_changed(p);
}
Expand Down

0 comments on commit a2bc601

Please sign in to comment.