Pārlūkot izejas kodu

fix missing code + movement points used

Laserlicht 1 gadu atpakaļ
vecāks
revīzija
611d5daa0f

+ 5 - 2
lib/gameState/GameStatistics.cpp

@@ -71,6 +71,7 @@ StatisticDataSetEntry StatisticDataSet::createEntry(const PlayerState * ps, cons
 	data.spentResourcesForArmy = gs->statistic.values.spentResourcesForArmy.count(ps->color) ? gs->statistic.values.spentResourcesForArmy.at(ps->color) : TResources();
 	data.spentResourcesForArmy = gs->statistic.values.spentResourcesForArmy.count(ps->color) ? gs->statistic.values.spentResourcesForArmy.at(ps->color) : TResources();
 	data.spentResourcesForBuildings = gs->statistic.values.spentResourcesForBuildings.count(ps->color) ? gs->statistic.values.spentResourcesForBuildings.at(ps->color) : TResources();
 	data.spentResourcesForBuildings = gs->statistic.values.spentResourcesForBuildings.count(ps->color) ? gs->statistic.values.spentResourcesForBuildings.at(ps->color) : TResources();
 	data.tradeVolume = gs->statistic.values.tradeVolume.count(ps->color) ? gs->statistic.values.tradeVolume.at(ps->color) : TResources();
 	data.tradeVolume = gs->statistic.values.tradeVolume.count(ps->color) ? gs->statistic.values.tradeVolume.at(ps->color) : TResources();
+	data.movementPointsUsed = gs->statistic.values.movementPointsUsed.count(ps->color) ? gs->statistic.values.movementPointsUsed.at(ps->color) : 0;
 
 
 	return data;
 	return data;
 }
 }
@@ -106,7 +107,8 @@ std::string StatisticDataSet::toCsv()
 	ss << "NumWinBattlesNeutral" << ";";
 	ss << "NumWinBattlesNeutral" << ";";
 	ss << "NumWinBattlesPlayer" << ";";
 	ss << "NumWinBattlesPlayer" << ";";
 	ss << "NumHeroSurrendered" << ";";
 	ss << "NumHeroSurrendered" << ";";
-	ss << "NumHeroEscaped";
+	ss << "NumHeroEscaped" << ";";
+	ss << "MovementPointsUsed";
 	for(auto & resource : resources)
 	for(auto & resource : resources)
 		ss << ";" << GameConstants::RESOURCE_NAMES[resource];
 		ss << ";" << GameConstants::RESOURCE_NAMES[resource];
 	for(auto & resource : resources)
 	for(auto & resource : resources)
@@ -146,7 +148,8 @@ std::string StatisticDataSet::toCsv()
 		ss << entry.numWinBattlesNeutral << ";";
 		ss << entry.numWinBattlesNeutral << ";";
 		ss << entry.numWinBattlesPlayer << ";";
 		ss << entry.numWinBattlesPlayer << ";";
 		ss << entry.numHeroSurrendered << ";";
 		ss << entry.numHeroSurrendered << ";";
-		ss << entry.numHeroEscaped;
+		ss << entry.numHeroEscaped << ";";
+		ss << entry.movementPointsUsed;
 		for(auto & resource : resources)
 		for(auto & resource : resources)
 			ss << ";" << entry.resources[resource];
 			ss << ";" << entry.resources[resource];
 		for(auto & resource : resources)
 		for(auto & resource : resources)

+ 7 - 0
lib/gameState/GameStatistics.h

@@ -52,6 +52,7 @@ struct DLL_LINKAGE StatisticDataSetEntry
 	TResources spentResourcesForArmy;
 	TResources spentResourcesForArmy;
 	TResources spentResourcesForBuildings;
 	TResources spentResourcesForBuildings;
 	TResources tradeVolume;
 	TResources tradeVolume;
+	si64 movementPointsUsed;
 
 
 	template <typename Handler> void serialize(Handler &h)
 	template <typename Handler> void serialize(Handler &h)
 	{
 	{
@@ -86,6 +87,7 @@ struct DLL_LINKAGE StatisticDataSetEntry
 		h & spentResourcesForArmy;
 		h & spentResourcesForArmy;
 		h & spentResourcesForBuildings;
 		h & spentResourcesForBuildings;
 		h & tradeVolume;
 		h & tradeVolume;
+		h & movementPointsUsed;
 	}
 	}
 };
 };
 
 
@@ -109,6 +111,7 @@ public:
 		std::map<PlayerColor, TResources> spentResourcesForArmy;
 		std::map<PlayerColor, TResources> spentResourcesForArmy;
 		std::map<PlayerColor, TResources> spentResourcesForBuildings;
 		std::map<PlayerColor, TResources> spentResourcesForBuildings;
 		std::map<PlayerColor, TResources> tradeVolume;
 		std::map<PlayerColor, TResources> tradeVolume;
+		std::map<PlayerColor, si64> movementPointsUsed;
 
 
 		template <typename Handler> void serialize(Handler &h)
 		template <typename Handler> void serialize(Handler &h)
 		{
 		{
@@ -118,6 +121,10 @@ public:
 			h & numWinBattlesPlayer;
 			h & numWinBattlesPlayer;
 			h & numHeroSurrendered;
 			h & numHeroSurrendered;
 			h & numHeroEscaped;
 			h & numHeroEscaped;
+			h & spentResourcesForArmy;
+			h & spentResourcesForBuildings;
+			h & tradeVolume;
+			h & movementPointsUsed;
 		}
 		}
 	};
 	};
 	ValueStorage values;
 	ValueStorage values;

+ 1 - 0
server/CGameHandler.cpp

@@ -1351,6 +1351,7 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, EMovementMode moveme
 
 
 		turnTimerHandler->setEndTurnAllowed(h->getOwner(), !movingOntoWater && !movingOntoObstacle);
 		turnTimerHandler->setEndTurnAllowed(h->getOwner(), !movingOntoWater && !movingOntoObstacle);
 		doMove(TryMoveHero::SUCCESS, lookForGuards, visitDest, LEAVING_TILE);
 		doMove(TryMoveHero::SUCCESS, lookForGuards, visitDest, LEAVING_TILE);
+		gs->statistic.values.movementPointsUsed[asker] += tmh.movePoints;
 		return true;
 		return true;
 	}
 	}
 }
 }