/** ** Update fog of war. */ void UpdateFogOfWarChange() { DebugPrint("::UpdateFogOfWarChange\n"); // Mark all explored fields as visible again. if (Map.NoFogOfWar) { //Wyrmgus start /* const unsigned int w = Map.Info.MapHeight * Map.Info.MapWidth; for (unsigned int index = 0; index != w; ++index) { CMapField &mf = *Map.Field(index); if (mf.playerInfo.IsExplored(*ThisPlayer)) { Map.MarkSeenTile(mf); } } */ for (size_t z = 0; z < Map.Fields.size(); ++z) { const unsigned int w = Map.Info.MapHeights[z] * Map.Info.MapWidths[z]; for (unsigned int index = 0; index != w; ++index) { CMapField &mf = *Map.Field(index, z); if (mf.playerInfo.IsExplored(*ThisPlayer)) { Map.MarkSeenTile(mf, z); } } } //Wyrmgus end } // Global seen recount. for (CUnitManager::Iterator it = UnitManager.begin(); it != UnitManager.end(); ++it) { CUnit &unit = **it; UnitCountSeen(unit); } }
/** ** Reveal the entire map. */ void CMap::Reveal() { // Mark every explored tile as visible. 1 turns into 2. Vec2i pos; for (pos.x = 0; pos.x < this->Info.MapWidth; ++pos.x) { for (pos.y = 0; pos.y < this->Info.MapHeight; ++pos.y) { for (int p = 0; p < PlayerMax; ++p) { if (!this->Field(pos)->Visible[p]) { this->Field(pos)->Visible[p] = 1; } } MarkSeenTile(pos); } } // Global seen recount. Simple and effective. for (CUnitManager::Iterator it = UnitManager.begin(); it != UnitManager.end(); ++it) { CUnit &unit = **it; // Reveal neutral buildings. Gold mines:) if (unit.Player->Type == PlayerNeutral) { for (int p = 0; p < PlayerMax; ++p) { if (Players[p].Type != PlayerNobody && (!(unit.Seen.ByPlayer & (1 << p)))) { UnitGoesOutOfFog(unit, Players[p]); UnitGoesUnderFog(unit, Players[p]); } } } UnitCountSeen(unit); } }
/** ** Reveal the entire map. */ void CMap::Reveal() { // Mark every explored tile as visible. 1 turns into 2. for (int i = 0; i != this->Info.MapWidth * this->Info.MapHeight; ++i) { CMapField &mf = *this->Field(i); CMapFieldPlayerInfo &playerInfo = mf.playerInfo; for (int p = 0; p < PlayerMax; ++p) { playerInfo.Visible[p] = std::max<unsigned short>(1, playerInfo.Visible[p]); } MarkSeenTile(mf); } // Global seen recount. Simple and effective. for (CUnitManager::Iterator it = UnitManager.begin(); it != UnitManager.end(); ++it) { CUnit &unit = **it; // Reveal neutral buildings. Gold mines:) if (unit.Player->Type == PlayerNeutral) { for (int p = 0; p < PlayerMax; ++p) { if (Players[p].Type != PlayerNobody && (!(unit.Seen.ByPlayer & (1 << p)))) { UnitGoesOutOfFog(unit, Players[p]); UnitGoesUnderFog(unit, Players[p]); } } } UnitCountSeen(unit); } }