Procházet zdrojové kódy

TurnInfo: add cache for bonuses selection

ArseniyShestakov před 10 roky
rodič
revize
cb61572878
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4 1
      lib/CPathfinder.cpp

+ 4 - 1
lib/CPathfinder.cpp

@@ -711,7 +711,10 @@ bool CPathfinder::addTeleportWhirlpool(const CGWhirlpool * obj) const
 TurnInfo::TurnInfo(const CGHeroInstance * Hero, const int turn)
 	: hero(Hero), maxMovePointsLand(-1), maxMovePointsWater(-1)
 {
-	bonuses = hero->getAllBonuses(Selector::days(turn), nullptr);
+	std::stringstream cachingStr;
+	cachingStr << "days_" << turn;
+
+	bonuses = hero->getAllBonuses(Selector::days(turn), nullptr, nullptr, cachingStr.str());
 }
 
 bool TurnInfo::isLayerAvailable(const EPathfindingLayer layer) const