StartInfo.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef STARTINFO_H
  2. #define STARTINFO_H
  3. #include "global.h"
  4. #include <vector>
  5. enum Ebonus {brandom=-1,bartifact, bgold, bresource};
  6. struct StartInfo
  7. {
  8. struct PlayerSettings
  9. {
  10. si32 castle, hero, //ID, if -1 then random, if -2 then none
  11. heroPortrait; //-1 if default, else ID
  12. std::string heroName;
  13. si8 bonus; //usees enum type Ebonus
  14. ui8 color; //from 0 -
  15. ui8 serial;
  16. ui8 handicap;//0-no, 1-mild, 2-severe
  17. std::string name;
  18. bool human;
  19. template <typename Handler> void serialize(Handler &h, const int version)
  20. {
  21. h & castle;
  22. h & hero;
  23. h & heroPortrait;
  24. h & heroName;
  25. h & bonus;
  26. h & color;
  27. h & serial;
  28. h & handicap;
  29. h & name;
  30. h & human;
  31. }
  32. };
  33. si32 difficulty; //0=easy; 4=impossible
  34. std::vector<PlayerSettings> playerInfos;
  35. ui8 turnTime; //in minutes, 0=unlimited
  36. std::string mapname;
  37. PlayerSettings & getIthPlayersSettings(int no)
  38. {
  39. for(unsigned int i=0; i<playerInfos.size(); ++i)
  40. if(playerInfos[i].color == no)
  41. return playerInfos[i];
  42. tlog1 << "Cannot find info about player " << no <<". Throwing...\n";
  43. throw std::string("Cannot find info about player");
  44. }
  45. template <typename Handler> void serialize(Handler &h, const int version)
  46. {
  47. h & difficulty;
  48. h & playerInfos;
  49. h & turnTime;
  50. h & mapname;
  51. }
  52. };
  53. #endif