1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

fix missing code + movement points used

This commit is contained in:
Laserlicht 2024-08-03 20:47:20 +02:00
parent eca04cbc54
commit 611d5daa0f
3 changed files with 13 additions and 2 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;
}
}