Memory leak fix: Make chunks unload properly (#1406)

* Fix chunk unload and cleanup logic, fixes #1347

* Applying formatting to code I edited 😝
This commit is contained in:
ModMaker101
2026-03-25 00:25:18 -04:00
committed by GitHub
parent 993052409a
commit a24318eedc
4 changed files with 68 additions and 46 deletions

View File

@@ -1690,7 +1690,16 @@ bool PlayerList::isXuidBanned(PlayerUID xuid)
}
// AP added for Vita so the range can be increased once the level starts
void PlayerList::setViewDistance(int newViewDistance)
void PlayerList::setViewDistance(const int newViewDistance)
{
viewDistance = newViewDistance;
for (size_t i = 0; i < server->levels.length; i++)
{
ServerLevel* level = server->levels[i];
if (level != nullptr)
{
level->getChunkMap()->setRadius(newViewDistance);
}
}
}