RandomMapTab.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * RandomMapTab.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 "CSelectionBase.h"
  12. #include "../../lib/FunctionList.h"
  13. #include "../../lib/GameConstants.h"
  14. #include "../../lib/rmg/CRmgTemplate.h"
  15. #include "../gui/InterfaceObjectConfigurable.h"
  16. #include "../lib/rmg/MapGenOptionsSaver.h"
  17. VCMI_LIB_NAMESPACE_BEGIN
  18. class CMapGenOptions;
  19. VCMI_LIB_NAMESPACE_END
  20. class CToggleButton;
  21. class CLabel;
  22. class CLabelGroup;
  23. class CSlider;
  24. class CPicture;
  25. class RandomMapTab : public InterfaceObjectConfigurable, public MapGenOptionsSaver
  26. {
  27. public:
  28. RandomMapTab();
  29. void updateMapInfoByHost();
  30. void setMapGenOptions(std::shared_ptr<CMapGenOptions> opts);
  31. void setTemplate(const CRmgTemplate *);
  32. void saveOptions(const CMapGenOptions & options) override;
  33. void loadOptions() override;
  34. CMapGenOptions & obtainMapGenOptions() {return *mapGenOptions;}
  35. CFunctionList<void(std::shared_ptr<CMapInfo>, std::shared_ptr<CMapGenOptions>)> mapInfoChanged;
  36. private:
  37. void deactivateButtonsFrom(CToggleGroup & group, const std::set<int> & allowed);
  38. std::vector<int> getPossibleMapSizes();
  39. std::shared_ptr<CMapInfo> mapInfo;
  40. std::shared_ptr<CMapGenOptions> mapGenOptions;
  41. //options allowed - need to store as impact each other
  42. std::set<int> playerCountAllowed;
  43. std::set<int> playerTeamsAllowed;
  44. std::set<int> compCountAllowed;
  45. std::set<int> compTeamsAllowed;
  46. };
  47. class TeamAlignmentsWidget: public InterfaceObjectConfigurable
  48. {
  49. public:
  50. TeamAlignmentsWidget(RandomMapTab & randomMapTab);
  51. private:
  52. void checkTeamCount();
  53. std::shared_ptr<CFilledTexture> background;
  54. std::shared_ptr<CLabelGroup> labels;
  55. std::shared_ptr<CButton> buttonOk;
  56. std::shared_ptr<CButton> buttonCancel;
  57. std::vector<std::shared_ptr<CToggleGroup>> players;
  58. std::vector<std::shared_ptr<CIntObject>> placeholders;
  59. };
  60. class TeamAlignments: public CWindowObject
  61. {
  62. std::shared_ptr<TeamAlignmentsWidget> widget;
  63. public:
  64. TeamAlignments(RandomMapTab & randomMapTab);
  65. };