diff --git a/lib/gameState/GameStatistics.cpp b/lib/gameState/GameStatistics.cpp index ec3ae5653..b29e2cc1c 100644 --- a/lib/gameState/GameStatistics.cpp +++ b/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.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.movementPointsUsed = gs->statistic.values.movementPointsUsed.count(ps->color) ? gs->statistic.values.movementPointsUsed.at(ps->color) : 0; return data; } @@ -106,7 +107,8 @@ std::string StatisticDataSet::toCsv() ss << "NumWinBattlesNeutral" << ";"; ss << "NumWinBattlesPlayer" << ";"; ss << "NumHeroSurrendered" << ";"; - ss << "NumHeroEscaped"; + ss << "NumHeroEscaped" << ";"; + ss << "MovementPointsUsed"; for(auto & resource : resources) ss << ";" << GameConstants::RESOURCE_NAMES[resource]; for(auto & resource : resources) @@ -146,7 +148,8 @@ std::string StatisticDataSet::toCsv() ss << entry.numWinBattlesNeutral << ";"; ss << entry.numWinBattlesPlayer << ";"; ss << entry.numHeroSurrendered << ";"; - ss << entry.numHeroEscaped; + ss << entry.numHeroEscaped << ";"; + ss << entry.movementPointsUsed; for(auto & resource : resources) ss << ";" << entry.resources[resource]; for(auto & resource : resources) diff --git a/lib/gameState/GameStatistics.h b/lib/gameState/GameStatistics.h index 7734f7977..95e22527e 100644 --- a/lib/gameState/GameStatistics.h +++ b/lib/gameState/GameStatistics.h @@ -52,6 +52,7 @@ struct DLL_LINKAGE StatisticDataSetEntry TResources spentResourcesForArmy; TResources spentResourcesForBuildings; TResources tradeVolume; + si64 movementPointsUsed; template <typename Handler> void serialize(Handler &h) { @@ -86,6 +87,7 @@ struct DLL_LINKAGE StatisticDataSetEntry h & spentResourcesForArmy; h & spentResourcesForBuildings; h & tradeVolume; + h & movementPointsUsed; } }; @@ -109,6 +111,7 @@ public: std::map<PlayerColor, TResources> spentResourcesForArmy; std::map<PlayerColor, TResources> spentResourcesForBuildings; std::map<PlayerColor, TResources> tradeVolume; + std::map<PlayerColor, si64> movementPointsUsed; template <typename Handler> void serialize(Handler &h) { @@ -118,6 +121,10 @@ public: h & numWinBattlesPlayer; h & numHeroSurrendered; h & numHeroEscaped; + h & spentResourcesForArmy; + h & spentResourcesForBuildings; + h & tradeVolume; + h & movementPointsUsed; } }; ValueStorage values; diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 1c0994af1..424df96a3 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -1351,6 +1351,7 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, EMovementMode moveme turnTimerHandler->setEndTurnAllowed(h->getOwner(), !movingOntoWater && !movingOntoObstacle); doMove(TryMoveHero::SUCCESS, lookForGuards, visitDest, LEAVING_TILE); + gs->statistic.values.movementPointsUsed[asker] += tmh.movePoints; return true; } }