GameStatistics.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * GameSTatistics.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../GameConstants.h"
  12. #include "../ResourceSet.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. struct PlayerState;
  15. class CGameState;
  16. struct DLL_LINKAGE StatisticDataSetEntry
  17. {
  18. int day;
  19. PlayerColor player;
  20. TeamID team;
  21. TResources resources;
  22. int heroesCount;
  23. int townCount;
  24. template <typename Handler> void serialize(Handler &h)
  25. {
  26. h & day;
  27. h & player;
  28. h & team;
  29. h & resources;
  30. h & heroesCount;
  31. h & townCount;
  32. }
  33. };
  34. class DLL_LINKAGE StatisticDataSet
  35. {
  36. std::vector<StatisticDataSetEntry> data;
  37. public:
  38. void add(StatisticDataSetEntry entry);
  39. static StatisticDataSetEntry createEntry(const PlayerState * ps, const CGameState * gs);
  40. std::string toCsv();
  41. template <typename Handler> void serialize(Handler &h)
  42. {
  43. h & data;
  44. }
  45. };
  46. VCMI_LIB_NAMESPACE_END