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 15, 2024
2 parents b0bd903 + f8f43aa commit e129062
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/client/fm_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void Client::createFarMesh(MapBlockP &block)
const auto &step = block->far_step;
MeshMakeData mdat(m_client, false, 0, step, &m_client->far_container);
mdat.m_blockpos = blockpos_actual;
auto mbmsh = std::make_shared<MapBlockMesh>(&mdat, m_camera_offset);
const auto mbmsh = std::make_shared<MapBlockMesh>(&mdat, m_camera_offset);
block->setFarMesh(mbmsh, step);
block->creating_far_mesh = false;
}
Expand Down
32 changes: 16 additions & 16 deletions src/client/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,11 +910,11 @@ void Hud::drawBlockBounds()
v3s16 pos = player->getStandingNodePos();

if (m_block_bounds_mode == BLOCK_BOUNDS_FAR_DRAWN) {
v3f offset = intToFloat(client->getCamera()->getOffset(), BS);
const auto offset = posToOpos(client->getCamera()->getOffset(), BS);

//s8 radius = m_block_bounds_mode == BLOCK_BOUNDS_NEAR ? 2 : 0;

v3f halfNode = v3f(BS, BS, BS) / 2.0f;
const auto halfNode = v3opos_t(BS, BS, BS) / 2.0f;
const auto &client_map = client->getEnv().getClientMap();
const auto & far_blocks = client_map.m_far_blocks;

Expand Down Expand Up @@ -961,19 +961,19 @@ void Hud::drawBlockBounds()
lod_step = mesh->lod_step;
far_step = mesh->far_step;
}
aabb3f box(
intToFloat((blockPos)*MAP_BLOCKSIZE, BS) - offset - halfNode + 1,
intToFloat(
const aabb3f box(
oposToV3f(intToFloat((blockPos)*MAP_BLOCKSIZE, BS) - offset - halfNode + 1),
oposToV3f(intToFloat(
((blockPos)*MAP_BLOCKSIZE) + (MAP_BLOCKSIZE * fscale - fscale),
BS) -
offset + halfNode - 1);
offset + halfNode - 1));
driver->draw3DBox(box, video::SColor(200 + b, 255 - lod_step * 10 + b,
255 -g - far_step * 10, fscale * 20));
}
}
} else if (m_block_bounds_mode == BLOCK_BOUNDS_FAR_REQUEST) {
const auto offset = intToFloat(client->getCamera()->getOffset(), BS);
const auto halfNode = v3f(BS, BS, BS) / 2.0f;
const auto halfNode = v3opos_t(BS, BS, BS) / 2.0f;
const auto &far_blocks = client->getEnv().getClientMap().m_far_blocks_ask;
{
for (const auto &[blockPos, step_ts] : far_blocks) {
Expand All @@ -982,19 +982,19 @@ void Hud::drawBlockBounds()
int lod_step = 0;
int far_step = 0;
int b = 0;
aabb3f box(
intToFloat((blockPos)*MAP_BLOCKSIZE, BS) - offset - halfNode + 1,
intToFloat(
const aabb3f box(
oposToV3f(intToFloat((blockPos)*MAP_BLOCKSIZE, BS) - offset - halfNode + 1),
oposToV3f(intToFloat(
((blockPos)*MAP_BLOCKSIZE) + (MAP_BLOCKSIZE << mesh_step ) - (1 << mesh_step), // - 1
BS) -
offset + halfNode - 1);
offset + halfNode - 1));
driver->draw3DBox(box, video::SColor(200 + b, 255 - lod_step * 10 + b,
255 - far_step * 10, fscale * 20));
}
}
} else if (m_block_bounds_mode == Hud::BLOCK_BOUNDS_FAR_STORAGE) {
const auto offset = intToFloat(client->getCamera()->getOffset(), BS);
const auto halfNode = v3f(BS, BS, BS) / 2.0f;
const auto halfNode = v3opos_t(BS, BS, BS) / 2.0f;
const auto &far_blocks = client->getEnv().getClientMap().far_blocks_storage;

for (size_t step = 0; step < far_blocks.size(); ++step) {
Expand All @@ -1006,12 +1006,12 @@ void Hud::drawBlockBounds()
int lod_step = 0;
int far_step = 0;
int b = 0;
aabb3f box(
intToFloat((blockPos)*MAP_BLOCKSIZE, BS) - offset - halfNode + 1,
intToFloat(
const aabb3f box(
oposToV3f(intToFloat((blockPos)*MAP_BLOCKSIZE, BS) - offset - halfNode + 1),
oposToV3f(intToFloat(
((blockPos)*MAP_BLOCKSIZE) + (MAP_BLOCKSIZE << (mesh_step) ) - (1 << mesh_step), ///// -1 ?
BS) -
offset + (halfNode - 1));
offset + (halfNode - 1)));
driver->draw3DBox(box, video::SColor(200 + b, 255 - lod_step * 10 + b,
255 - far_step * 10, fscale * 20 + 20*has_mesh));
}
Expand Down
3 changes: 3 additions & 0 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ Server::~Server()

// Stop threads
if (m_thread) {
if (m_env) m_env->getServerMap().save(MOD_STATE_WRITE_AT_UNLOAD); // save before merge thread exit
stop();
delete m_thread;
}
Expand Down Expand Up @@ -719,6 +720,8 @@ void Server::stop()
{
infostream<<"Server: Stopping and waiting threads"<<std::endl;

if (m_env) m_env->getServerMap().save(MOD_STATE_WRITE_AT_UNLOAD);

// Stop threads (set run=false first so both start stopping)
m_thread->stop();

Expand Down

0 comments on commit e129062

Please sign in to comment.