Browse Source

TurnInfo: add cache for bonuses selection

ArseniyShestakov 10 years ago
parent
commit
cb61572878
1 changed files with 4 additions and 1 deletions
  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