mirror of
https://github.com/glest/glest-source.git
synced 2025-02-25 04:02:30 +01:00
bugfix for minimap for joining in progress games
This commit is contained in:
parent
56774bc087
commit
8cd2383a78
@ -1882,6 +1882,10 @@ void Map::loadGame(const XmlNode *rootNode, World *world) {
|
||||
string value = tokensExploredValue[k];
|
||||
|
||||
surfaceCell.setExplored(k,strToInt(value) != 0);
|
||||
|
||||
//if(surfaceCell.isExplored(k) == true) {
|
||||
// printf("Setting cell at index: %d for team: %d to: %d [%s]\n",surfaceCellIndexExplored,k,surfaceCell.isExplored(k),value.c_str());
|
||||
//}
|
||||
}
|
||||
surfaceCellIndexExplored++;
|
||||
}
|
||||
|
@ -283,6 +283,36 @@ void World::clearTileset() {
|
||||
tileset = Tileset();
|
||||
}
|
||||
|
||||
void World::restoreExploredFogOfWarCells() {
|
||||
for (int i = 0; i < map.getSurfaceW(); ++i) {
|
||||
for (int j = 0; j < map.getSurfaceH(); ++j) {
|
||||
for (int k = 0; k < GameConstants::maxPlayers + GameConstants::specialFactions; ++k) {
|
||||
if (k == thisTeamIndex) {
|
||||
if (map.getSurfaceCell(i, j)->isExplored(k) == true) {
|
||||
const Vec2i pos(i, j);
|
||||
Vec2i surfPos = pos;
|
||||
//compute max alpha
|
||||
float maxAlpha = 0.0f;
|
||||
if (surfPos.x > 1 && surfPos.y > 1
|
||||
&& surfPos.x < map.getSurfaceW() - 2
|
||||
&& surfPos.y < map.getSurfaceH() - 2) {
|
||||
maxAlpha = 1.f;
|
||||
} else if (surfPos.x > 0 && surfPos.y > 0
|
||||
&& surfPos.x < map.getSurfaceW() - 1
|
||||
&& surfPos.y < map.getSurfaceH() - 1) {
|
||||
maxAlpha = 0.3f;
|
||||
}
|
||||
|
||||
//compute alpha
|
||||
float alpha = maxAlpha;
|
||||
minimap.incFowTextureAlphaSurface(surfPos, alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void World::init(Game *game, bool createUnits, bool initFactions){
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
@ -371,8 +401,11 @@ void World::init(Game *game, bool createUnits, bool initFactions){
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
restoreExploredFogOfWarCells();
|
||||
}
|
||||
|
||||
minimap.loadGame(loadWorldNode);
|
||||
//minimap.loadGame(loadWorldNode);
|
||||
}
|
||||
|
||||
//initExplorationState(); ... was only for !fog-of-war, now handled in initCells()
|
||||
|
@ -341,6 +341,7 @@ private:
|
||||
void updateAllFactionUnits();
|
||||
void underTakeDeadFactionUnits();
|
||||
void updateAllFactionConsumableCosts();
|
||||
void restoreExploredFogOfWarCells();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
Loading…
x
Reference in New Issue
Block a user