windownewmap.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * windownewmap.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 <QDialog>
  12. #include "../lib/mapping/CMapHeader.h"
  13. #include "../lib/rmg/CMapGenOptions.h"
  14. namespace Ui
  15. {
  16. class WindowNewMap;
  17. }
  18. class WindowNewMap : public QDialog
  19. {
  20. Q_OBJECT
  21. const QString newMapWindow = "NewMapWindow/Settings";
  22. const QString newMapWidth = "NewMapWindow/Width";
  23. const QString newMapHeight = "NewMapWindow/Height";
  24. const QString newMapTwoLevel = "NewMapWindow/TwoLevel";
  25. const QString newMapGenerateRandom = "NewMapWindow/GenerateRandom";
  26. const QString newMapPlayers = "NewMapWindow/Players"; //map index
  27. const QString newMapCpuPlayers = "NewMapWindow/CpuPlayers"; //map index
  28. const QString newMapHumanTeams = "NewMapWindow/HumanTeams"; //map index
  29. const QString newMapCpuTeams = "NewMapWindow/CpuTeams"; //map index
  30. const QString newMapWaterContent = "NewMapWindow/WaterContent";
  31. const QString newMapMonsterStrength = "NewMapWindow/MonsterStrength";
  32. const QString newMapTemplate = "NewMapWindow/Template";
  33. const QString randomString = "Random";
  34. const std::map<int, int> players
  35. {
  36. {0, CMapGenOptions::RANDOM_SIZE},
  37. {1, 1},
  38. {2, 2},
  39. {3, 3},
  40. {4, 4},
  41. {5, 5},
  42. {6, 6},
  43. {7, 7},
  44. {8, 8}
  45. };
  46. const std::map<int, int> cpuPlayers
  47. {
  48. {0, CMapGenOptions::RANDOM_SIZE},
  49. {1, 0},
  50. {2, 1},
  51. {3, 2},
  52. {4, 3},
  53. {5, 4},
  54. {6, 5},
  55. {7, 6},
  56. {8, 7}
  57. };
  58. const std::map<int, std::pair<int, int>> mapSizes
  59. {
  60. {0, {CMapHeader::MAP_SIZE_SMALL, CMapHeader::MAP_SIZE_SMALL}},
  61. {1, {CMapHeader::MAP_SIZE_MIDDLE, CMapHeader::MAP_SIZE_MIDDLE}},
  62. {2, {CMapHeader::MAP_SIZE_LARGE, CMapHeader::MAP_SIZE_LARGE}},
  63. {3, {CMapHeader::MAP_SIZE_XLARGE, CMapHeader::MAP_SIZE_XLARGE}},
  64. {4, {CMapHeader::MAP_SIZE_HUGE, CMapHeader::MAP_SIZE_HUGE}},
  65. {5, {CMapHeader::MAP_SIZE_XHUGE, CMapHeader::MAP_SIZE_XHUGE}},
  66. {6, {CMapHeader::MAP_SIZE_GIANT, CMapHeader::MAP_SIZE_GIANT}},
  67. };
  68. public:
  69. explicit WindowNewMap(QWidget *parent = nullptr);
  70. ~WindowNewMap();
  71. private slots:
  72. void on_cancelButton_clicked();
  73. void on_okButton_clicked();
  74. void on_sizeCombo_activated(int index);
  75. void on_twoLevelCheck_stateChanged(int arg1);
  76. void on_humanCombo_activated(int index);
  77. void on_cpuCombo_activated(int index);
  78. void on_randomMapCheck_stateChanged(int arg1);
  79. void on_templateCombo_activated(int index);
  80. void on_widthTxt_textChanged(const QString &arg1);
  81. void on_heightTxt_textChanged(const QString &arg1);
  82. void on_checkSeed_toggled(bool checked);
  83. void on_humanTeamsCombo_activated(int index);
  84. void on_cpuTeamsCombo_activated(int index);
  85. private:
  86. void updateTemplateList();
  87. bool loadUserSettings();
  88. void saveUserSettings();
  89. private:
  90. Ui::WindowNewMap *ui;
  91. CMapGenOptions mapGenOptions;
  92. bool randomMap = false;
  93. };