RandomMapTab.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. VCMI_LIB_NAMESPACE_BEGIN
  17. class CMapGenOptions;
  18. VCMI_LIB_NAMESPACE_END
  19. class CToggleButton;
  20. class CLabel;
  21. class CLabelGroup;
  22. class CSlider;
  23. class CPicture;
  24. class FilledTexturePlayerColored;
  25. class RandomMapTab : public InterfaceObjectConfigurable
  26. {
  27. public:
  28. RandomMapTab();
  29. void updateMapInfoByHost();
  30. void setMapGenOptions(std::shared_ptr<CMapGenOptions> opts);
  31. void setTemplate(const CRmgTemplate *);
  32. CMapGenOptions & obtainMapGenOptions() {return *mapGenOptions;}
  33. CFunctionList<void(std::shared_ptr<CMapInfo>, std::shared_ptr<CMapGenOptions>)> mapInfoChanged;
  34. private:
  35. void deactivateButtonsFrom(CToggleGroup & group, const std::set<int> & allowed);
  36. std::vector<int> getPossibleMapSizes();
  37. std::shared_ptr<CMapGenOptions> mapGenOptions;
  38. std::shared_ptr<CMapInfo> mapInfo;
  39. //options allowed - need to store as impact each other
  40. std::set<int> playerCountAllowed, playerTeamsAllowed, compCountAllowed, compTeamsAllowed;
  41. };
  42. class TeamAlignmentsWidget: public InterfaceObjectConfigurable
  43. {
  44. public:
  45. TeamAlignmentsWidget(RandomMapTab & randomMapTab);
  46. private:
  47. std::shared_ptr<CFilledTexture> background;
  48. std::shared_ptr<CLabelGroup> labels;
  49. std::shared_ptr<CButton> buttonOk, buttonCancel;
  50. std::vector<std::shared_ptr<CToggleGroup>> players;
  51. std::vector<std::shared_ptr<CIntObject>> placeholders;
  52. };
  53. class TeamAlignments: public CWindowObject
  54. {
  55. std::shared_ptr<TeamAlignmentsWidget> widget;
  56. public:
  57. TeamAlignments(RandomMapTab & randomMapTab);
  58. };