1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00
vcmi/lib/gameState/GameStatistics.h

56 lines
1.0 KiB
C++
Raw Normal View History

2024-07-27 02:11:26 +02:00
/*
* GameSTatistics.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "../GameConstants.h"
2024-08-01 21:30:53 +02:00
#include "../ResourceSet.h"
2024-07-27 02:11:26 +02:00
VCMI_LIB_NAMESPACE_BEGIN
2024-08-01 21:30:53 +02:00
struct PlayerState;
class CGameState;
2024-07-27 02:11:26 +02:00
struct DLL_LINKAGE StatisticDataSetEntry
{
int day;
PlayerColor player;
2024-08-01 21:30:53 +02:00
TeamID team;
TResources resources;
int heroesCount;
int townCount;
2024-07-27 02:11:26 +02:00
template <typename Handler> void serialize(Handler &h)
{
h & day;
h & player;
2024-08-01 21:30:53 +02:00
h & team;
h & resources;
h & heroesCount;
h & townCount;
2024-07-27 02:11:26 +02:00
}
};
class DLL_LINKAGE StatisticDataSet
{
std::vector<StatisticDataSetEntry> data;
public:
void add(StatisticDataSetEntry entry);
2024-08-01 21:30:53 +02:00
static StatisticDataSetEntry createEntry(const PlayerState * ps, const CGameState * gs);
2024-07-27 02:11:26 +02:00
std::string toCsv();
template <typename Handler> void serialize(Handler &h)
{
h & data;
}
};
VCMI_LIB_NAMESPACE_END