HighScore.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * HighScore.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. VCMI_LIB_NAMESPACE_BEGIN
  13. class CGameState;
  14. class DLL_LINKAGE HighScoreParameter
  15. {
  16. public:
  17. int difficulty;
  18. int day;
  19. int townAmount;
  20. bool usedCheat;
  21. bool hasGrail;
  22. bool allEnemiesDefeated;
  23. std::string campaignName;
  24. std::string scenarioName;
  25. std::string playerName;
  26. template <typename Handler> void serialize(Handler &h)
  27. {
  28. h & difficulty;
  29. h & day;
  30. h & townAmount;
  31. h & usedCheat;
  32. h & hasGrail;
  33. h & allEnemiesDefeated;
  34. h & campaignName;
  35. h & scenarioName;
  36. h & playerName;
  37. }
  38. };
  39. class DLL_LINKAGE HighScore
  40. {
  41. public:
  42. static HighScoreParameter prepareHighScores(const CGameState * gs, PlayerColor player, bool victory);
  43. };
  44. class DLL_LINKAGE HighScoreCalculation
  45. {
  46. public:
  47. struct Result
  48. {
  49. int basic = 0;
  50. int total = 0;
  51. int sumDays = 0;
  52. bool cheater = false;
  53. };
  54. std::vector<HighScoreParameter> parameters;
  55. bool isCampaign = false;
  56. Result calculate();
  57. static CreatureID getCreatureForPoints(int points, bool campaign);
  58. };
  59. VCMI_LIB_NAMESPACE_END