Selaa lähdekoodia

Reduce excessive FoW updates

Ivan Savenko 9 kuukautta sitten
vanhempi
sitoutus
9f56c00336
2 muutettua tiedostoa jossa 5 lisäystä ja 5 poistoa
  1. 2 4
      server/CGameHandler.cpp
  2. 3 1
      server/processors/PlayerMessageProcessor.cpp

+ 2 - 4
server/CGameHandler.cpp

@@ -4115,12 +4115,10 @@ void CGameHandler::changeFogOfWar(const std::unordered_set<int3> &tiles, PlayerC
 
 		for (auto tile : observedTiles)
 			vstd::erase_if_present (fow.tiles, tile);
-
-		if (fow.tiles.empty())
-			return;
 	}
 
-	sendAndApply(fow);
+	if (!fow.tiles.empty())
+		sendAndApply(fow);
 }
 
 const CGHeroInstance * CGameHandler::getVisitingHero(const CGObjectInstance *obj)

+ 3 - 1
server/processors/PlayerMessageProcessor.cpp

@@ -618,7 +618,9 @@ void PlayerMessageProcessor::cheatMapReveal(PlayerColor player, bool reveal)
 
 	fc.tiles.insert(hlp_tab, hlp_tab + lastUnc);
 	delete [] hlp_tab;
-	gameHandler->sendAndApply(fc);
+
+	if (!fc.tiles.empty())
+		gameHandler->sendAndApply(fc);
 }
 
 void PlayerMessageProcessor::cheatPuzzleReveal(PlayerColor player)