windownewmap.h 2.8 KB

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