Add extra reveal chunk tracker unordered map to prevent minimap updates every single frame the player character walked. Release Build 10027.

This commit is contained in:
sigonasr2 2024-07-15 05:19:50 -05:00
parent 210dd3b9de
commit 38710151c4
4 changed files with 7 additions and 3 deletions

View File

@ -175,6 +175,8 @@ void Minimap::Reset(){
UpdateChunk(game->GetCurrentMapName(),chunkPos,InitialLoad::YES); UpdateChunk(game->GetCurrentMapName(),chunkPos,InitialLoad::YES);
} }
#pragma endregion #pragma endregion
revealedChunks.clear();
} }
void Minimap::Update(){ void Minimap::Update(){
@ -187,7 +189,9 @@ void Minimap::Update(){
void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos,const InitialLoad initialLoad){ void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos,const InitialLoad initialLoad){
if(game->TestingModeEnabled())return; if(game->TestingModeEnabled())return;
loadedChunks[map].insert(std::format("{}_{}",chunkPos.x,chunkPos.y)); const bool minimapChunkLoadSucceeded{loadedChunks[map].insert(std::format("{}_{}",chunkPos.x,chunkPos.y)).second};
const bool minimapChunkRevealSucceeded{revealedChunks[map].insert(std::format("{}_{}",chunkPos.x,chunkPos.y)).second};
if(!minimapChunkLoadSucceeded&&!minimapChunkRevealSucceeded)return;
if(game->GetCurrentMapName()!=map)return; //Don't update the minimap when the map name doesn't match the current map. if(game->GetCurrentMapName()!=map)return; //Don't update the minimap when the map name doesn't match the current map.

View File

@ -70,7 +70,7 @@ private:
Renderable minimap; Renderable minimap;
Renderable cover; Renderable cover;
Renderable coverOutline; Renderable coverOutline;
std::unordered_map<MapName,std::unordered_set<std::string>>loadedChunks; std::unordered_map<MapName,std::unordered_set<std::string>>loadedChunks,revealedChunks;
MinimapMode displayMode=MinimapMode::SMALL; MinimapMode displayMode=MinimapMode::SMALL;
bool MinimapVisible(); bool MinimapVisible();

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 3 #define VERSION_PATCH 3
#define VERSION_BUILD 10024 #define VERSION_BUILD 10027
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a