1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Use thread_local instead from some static settings (#5955)

thread_local permits to limit variable lifetime to thread duration. Use it on each setting place which uses static to cache variable result only for thread lifetime. This permits to keep the same performance level & reconfigure server from MT gui in those various variables places.

Add thread_local to undersampling calculation too.
This commit is contained in:
Loïc Blot 2017-06-11 13:58:43 +02:00 committed by GitHub
parent ff73c7a5da
commit 65819f3b9f
8 changed files with 22 additions and 16 deletions

View file

@ -3637,7 +3637,7 @@ PointedThing Game::updatePointedThing(
std::vector<aabb3f> *selectionboxes = hud->getSelectionBoxes();
selectionboxes->clear();
hud->setSelectedFaceNormal(v3f(0.0, 0.0, 0.0));
static const bool show_entity_selectionbox = g_settings->getBool(
static thread_local const bool show_entity_selectionbox = g_settings->getBool(
"show_entity_selectionbox");
ClientMap &map = client->getEnv().getClientMap();
@ -3980,7 +3980,7 @@ void Game::handleDigging(const PointedThing &pointed, const v3s16 &nodepos,
bool is_valid_position;
MapNode wasnode = map.getNodeNoEx(nodepos, &is_valid_position);
if (is_valid_position) {
if (client->moddingEnabled() &&
if (client->moddingEnabled() &&
client->getScript()->on_dignode(nodepos, wasnode)) {
return;
}