mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-05 00:49:09 +02:00
More work on static variable desyncs
This commit is contained in:
@ -735,8 +735,12 @@ int3 CPlayerSpecificInfoCallback::getGrailPos( double *outKnownRatio )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*outKnownRatio = static_cast<double>(CGObelisk::visited[gs->getPlayerTeam(*player)->id])
|
TeamID t = gs->getPlayerTeam(*player)->id;
|
||||||
/ CGObelisk::obeliskCount;
|
double visited = 0.0;
|
||||||
|
if(CGObelisk::visited.count(t))
|
||||||
|
visited = static_cast<double>(CGObelisk::visited[t]);
|
||||||
|
|
||||||
|
*outKnownRatio = visited / CGObelisk::obeliskCount;
|
||||||
}
|
}
|
||||||
return gs->map->grailPos;
|
return gs->map->grailPos;
|
||||||
}
|
}
|
||||||
|
@ -787,6 +787,16 @@ void CGameState::init(StartInfo * si)
|
|||||||
initVisitingAndGarrisonedHeroes();
|
initVisitingAndGarrisonedHeroes();
|
||||||
initFogOfWar();
|
initFogOfWar();
|
||||||
|
|
||||||
|
// Explicitly initialize static variables
|
||||||
|
for(auto & elem : players)
|
||||||
|
{
|
||||||
|
CGKeys::playerKeyMap[elem.first] = {};
|
||||||
|
}
|
||||||
|
for(auto & elem : teams)
|
||||||
|
{
|
||||||
|
CGObelisk::visited[elem.first] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
logGlobal->debug("\tChecking objectives");
|
logGlobal->debug("\tChecking objectives");
|
||||||
map->checkForObjectives(); //needs to be run when all objects are properly placed
|
map->checkForObjectives(); //needs to be run when all objects are properly placed
|
||||||
|
|
||||||
@ -2637,7 +2647,15 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
|
|||||||
}
|
}
|
||||||
if(level >= 3) //obelisks found
|
if(level >= 3) //obelisks found
|
||||||
{
|
{
|
||||||
FILL_FIELD(obelisks, CGObelisk::visited[gs->getPlayerTeam(g->second.color)->id])
|
auto getObeliskVisited = [](TeamID t)
|
||||||
|
{
|
||||||
|
if(CGObelisk::visited.count(t))
|
||||||
|
return CGObelisk::visited[t];
|
||||||
|
else
|
||||||
|
return ui8(0);
|
||||||
|
};
|
||||||
|
|
||||||
|
FILL_FIELD(obelisks, getObeliskVisited(gs->getPlayerTeam(g->second.color)->id))
|
||||||
}
|
}
|
||||||
if(level >= 4) //artifacts
|
if(level >= 4) //artifacts
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user