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 14, 2024
2 parents bd307ed + d0f846d commit 13da11b
Show file tree
Hide file tree
Showing 12 changed files with 367 additions and 186 deletions.
3 changes: 1 addition & 2 deletions src/client/fm_far_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const MapNode &FarContainer::getNodeRefUnsafe(const v3pos_t &pos)

const auto &storage =
m_client->getEnv().getClientMap().far_blocks_storage[fmesh_step];
if (const auto &it = storage.find(bpos_aligned); it != storage.end()) {
const auto &block = it->second;
if (const auto &block = storage.at_or(bpos_aligned)) {
v3pos_t relpos = pos - bpos_aligned * MAP_BLOCKSIZE;

const auto &relpos_shift = fmesh_step; // + 1;
Expand Down
4 changes: 2 additions & 2 deletions src/fm_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ u32 Map::timerUpdate(float uptime, float unload_timeout, s32 max_loaded_blocks,

auto m_blocks_size = m_blocks.size();

for (auto ir : m_blocks) {
for (const auto &ir : m_blocks) {
if (n++ < m_blocks_update_last) {
continue;
} else {
Expand Down Expand Up @@ -1139,7 +1139,7 @@ const v3pos_t g_4dirs[4] = {
};

bool ServerMap::propagateSunlight(
const v3pos_t &pos, std::set<v3pos_t> &light_sources, bool remove_light)
const v3bpos_t &pos, std::set<v3pos_t> &light_sources, bool remove_light)
{
MapBlock *block = getBlockNoCreateNoEx(pos);

Expand Down
9 changes: 4 additions & 5 deletions src/fm_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,14 +585,13 @@ MapDatabase *Server::GetFarDatabase(MapBlock::block_step_t step)
return dbases[step].get();
};

MapBlockP Server::loadBlockNoStore(MapDatabase *dbase, const v3bpos_t &pos)
MapBlockP Server::loadBlockNoStore(MapDatabase *dbase, const v3bpos_t &bpos)
{
auto *m_server = this;
try {
auto block =
std::make_shared<MapBlock>(nullptr, pos, m_server); // &m_server->getMap()
MapBlockP block{m_server->getEnv().getServerMap().createBlankBlockNoInsert(bpos)};
std::string blob;
dbase->loadBlock(pos, &blob);
dbase->loadBlock(bpos, &blob);
if (!blob.length()) {
return {};
}
Expand All @@ -612,7 +611,7 @@ MapBlockP Server::loadBlockNoStore(MapDatabase *dbase, const v3bpos_t &pos)
}
return block;
} catch (const std::exception &ex) {
errorstream << "Block load fail " << pos << " : " << ex.what() << "\n";
errorstream << "Block load fail " << bpos << " : " << ex.what() << "\n";
}
return {};
}
Expand Down
Loading

0 comments on commit 13da11b

Please sign in to comment.