46 QGridLayout *GBoxOptionsLayout = new QGridLayout(GBoxOptions); |
47 QGridLayout *GBoxOptionsLayout = new QGridLayout(GBoxOptions); |
47 |
48 |
48 QTableView * tv = new QTableView(this); |
49 QTableView * tv = new QTableView(this); |
49 tv->setModel(new AmmoSchemeModel); |
50 tv->setModel(new AmmoSchemeModel); |
50 GBoxOptionsLayout->addWidget(tv, 0, 0, 1, 2); |
51 GBoxOptionsLayout->addWidget(tv, 0, 0, 1, 2); |
|
52 |
|
53 QPushButton * goToSchemePage = new QPushButton(GBoxOptions); |
|
54 goToSchemePage->setText(tr("Edit schemes")); |
|
55 GBoxOptionsLayout->addWidget(goToSchemePage, 1, 0, 1, 2); |
|
56 connect(goToSchemePage, SIGNAL(clicked()), this, SIGNAL(goToSchemes())); |
51 |
57 |
52 CB_mode_Forts = new QCheckBox(GBoxOptions); |
|
53 CB_mode_Forts->setText(QCheckBox::tr("Forts mode")); |
|
54 GBoxOptionsLayout->addWidget(CB_mode_Forts, 9, 0, 1, 2); |
|
55 |
|
56 CB_teamsDivide = new QCheckBox(GBoxOptions); |
|
57 CB_teamsDivide->setText(QCheckBox::tr("Divide teams")); |
|
58 GBoxOptionsLayout->addWidget(CB_teamsDivide, 1, 0, 1, 2); |
|
59 |
|
60 CB_solid = new QCheckBox(GBoxOptions); |
|
61 CB_solid->setText(QCheckBox::tr("Solid land")); |
|
62 GBoxOptionsLayout->addWidget(CB_solid, 2, 0, 1, 2); |
|
63 |
|
64 CB_border = new QCheckBox(GBoxOptions); |
|
65 CB_border->setText(QCheckBox::tr("Add Border")); |
|
66 GBoxOptionsLayout->addWidget(CB_border, 3, 0, 1, 2); |
|
67 |
|
68 L_TurnTime = new QLabel(QLabel::tr("Turn time"), GBoxOptions); |
|
69 L_InitHealth = new QLabel(QLabel::tr("Initial health"), GBoxOptions); |
|
70 L_SuddenDeath = new QLabel(QLabel::tr("Turns before SD"), GBoxOptions); |
|
71 L_CaseProb = new QLabel(QLabel::tr("Crate drops"), GBoxOptions); |
|
72 GBoxOptionsLayout->addWidget(L_TurnTime, 4, 0); |
|
73 GBoxOptionsLayout->addWidget(L_InitHealth, 5, 0); |
|
74 GBoxOptionsLayout->addWidget(L_SuddenDeath, 6, 0); |
|
75 GBoxOptionsLayout->addWidget(L_CaseProb, 7, 0); |
|
76 GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 8, 0); |
58 GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 8, 0); |
77 |
59 |
78 SB_TurnTime = new QSpinBox(GBoxOptions); |
|
79 SB_TurnTime->setRange(1, 99); |
|
80 SB_TurnTime->setValue(45); |
|
81 SB_TurnTime->setSingleStep(15); |
|
82 |
|
83 SB_InitHealth = new QSpinBox(GBoxOptions); |
|
84 SB_InitHealth->setRange(50, 200); |
|
85 SB_InitHealth->setValue(100); |
|
86 SB_InitHealth->setSingleStep(25); |
|
87 |
|
88 SB_SuddenDeath = new QSpinBox(GBoxOptions); |
|
89 SB_SuddenDeath->setRange(0, 50); |
|
90 SB_SuddenDeath->setValue(15); |
|
91 SB_SuddenDeath->setSingleStep(3); |
|
92 |
|
93 SB_CaseProb = new FreqSpinBox(GBoxOptions); |
|
94 SB_CaseProb->setRange(0, 9); |
|
95 SB_CaseProb->setValue(5); |
|
96 |
|
97 GBoxOptionsLayout->addWidget(SB_TurnTime, 4, 1); |
|
98 GBoxOptionsLayout->addWidget(SB_InitHealth, 5, 1); |
|
99 GBoxOptionsLayout->addWidget(SB_SuddenDeath, 6, 1); |
|
100 GBoxOptionsLayout->addWidget(SB_CaseProb, 7, 1); |
|
101 |
|
102 WeaponsName = new QComboBox(GBoxOptions); |
60 WeaponsName = new QComboBox(GBoxOptions); |
103 GBoxOptionsLayout->addWidget(WeaponsName, 8, 1); |
61 GBoxOptionsLayout->addWidget(WeaponsName, 8, 1); |
104 |
62 |
105 connect(SB_InitHealth, SIGNAL(valueChanged(int)), this, SLOT(initHealthChanged(int))); |
|
106 connect(SB_TurnTime, SIGNAL(valueChanged(int)), this, SLOT(turnTimeChanged(int))); |
|
107 connect(SB_SuddenDeath, SIGNAL(valueChanged(int)), this, SLOT(suddenDeathTurnsChanged(int))); |
|
108 connect(SB_CaseProb, SIGNAL(valueChanged(int)), this, SLOT(caseProbabilityChanged(int))); |
|
109 connect(CB_mode_Forts, SIGNAL(toggled(bool)), this, SLOT(fortsModeChanged(bool))); |
|
110 connect(CB_teamsDivide, SIGNAL(toggled(bool)), this, SLOT(teamsDivideChanged(bool))); |
|
111 connect(CB_solid, SIGNAL(toggled(bool)), this, SLOT(solidChanged(bool))); |
|
112 connect(CB_border, SIGNAL(toggled(bool)), this, SLOT(borderChanged(bool))); |
|
113 connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int))); |
63 connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int))); |
114 |
64 |
115 connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &))); |
65 connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &))); |
116 connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &))); |
66 connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &))); |
117 connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &))); |
67 connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &))); |
120 |
70 |
121 quint32 GameCFGWidget::getGameFlags() const |
71 quint32 GameCFGWidget::getGameFlags() const |
122 { |
72 { |
123 quint32 result = 0; |
73 quint32 result = 0; |
124 |
74 |
125 if (CB_mode_Forts->isChecked()) |
75 /* if (CB_mode_Forts->isChecked()) |
126 result |= 0x01; |
76 result |= 0x01; |
127 if (CB_teamsDivide->isChecked()) |
77 if (CB_teamsDivide->isChecked()) |
128 result |= 0x10; |
78 result |= 0x10; |
129 if (CB_solid->isChecked()) |
79 if (CB_solid->isChecked()) |
130 result |= 0x04; |
80 result |= 0x04; |
131 if (CB_border->isChecked()) |
81 if (CB_border->isChecked()) |
132 result |= 0x08; |
82 result |= 0x08;*/ |
133 |
83 |
134 return result; |
84 return result; |
135 } |
85 } |
136 |
86 |
137 quint32 GameCFGWidget::getInitHealth() const |
87 quint32 GameCFGWidget::getInitHealth() const |
138 { |
88 { |
139 return SB_InitHealth->value(); |
89 // return SB_InitHealth->value(); |
140 } |
90 } |
141 |
91 |
142 QStringList GameCFGWidget::getFullConfig() const |
92 QStringList GameCFGWidget::getFullConfig() const |
143 { |
93 { |
144 QStringList sl; |
94 QStringList sl; |
145 sl.append("eseed " + pMapContainer->getCurrentSeed()); |
95 sl.append("eseed " + pMapContainer->getCurrentSeed()); |
146 sl.append(QString("e$gmflags %1").arg(getGameFlags())); |
96 sl.append(QString("e$gmflags %1").arg(getGameFlags())); |
147 sl.append(QString("e$turntime %1").arg(SB_TurnTime->value() * 1000)); |
97 // sl.append(QString("e$turntime %1").arg(SB_TurnTime->value() * 1000)); |
148 sl.append(QString("e$sd_turns %1").arg(SB_SuddenDeath->value())); |
98 // sl.append(QString("e$sd_turns %1").arg(SB_SuddenDeath->value())); |
149 sl.append(QString("e$casefreq %1").arg(SB_CaseProb->value())); |
99 // sl.append(QString("e$casefreq %1").arg(SB_CaseProb->value())); |
150 sl.append(QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter())); |
100 sl.append(QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter())); |
151 |
101 |
152 QString currentMap = pMapContainer->getCurrentMap(); |
102 QString currentMap = pMapContainer->getCurrentMap(); |
153 if (currentMap.size() > 0) |
103 if (currentMap.size() > 0) |
154 sl.append("emap " + currentMap); |
104 sl.append("emap " + currentMap); |
209 if (param == "THEME") { |
151 if (param == "THEME") { |
210 pMapContainer->setTheme(value); |
152 pMapContainer->setTheme(value); |
211 return; |
153 return; |
212 } |
154 } |
213 if (param == "HEALTH") { |
155 if (param == "HEALTH") { |
214 SB_InitHealth->setValue(value.toUInt()); |
156 // SB_InitHealth->setValue(value.toUInt()); |
215 return; |
157 return; |
216 } |
158 } |
217 if (param == "TURNTIME") { |
159 if (param == "TURNTIME") { |
218 SB_TurnTime->setValue(value.toUInt()); |
160 // SB_TurnTime->setValue(value.toUInt()); |
219 return; |
161 return; |
220 } |
162 } |
221 if (param == "SD_TURNS") { |
163 if (param == "SD_TURNS") { |
222 SB_SuddenDeath->setValue(value.toUInt()); |
164 // SB_SuddenDeath->setValue(value.toUInt()); |
223 return; |
165 return; |
224 } |
166 } |
225 if (param == "CASEFACTOR") { |
167 if (param == "CASEFACTOR") { |
226 SB_CaseProb->setValue(value.toUInt()); |
168 // SB_CaseProb->setValue(value.toUInt()); |
227 return; |
169 return; |
228 } |
170 } |
229 if (param == "FORTSMODE") { |
171 if (param == "FORTSMODE") { |
230 CB_mode_Forts->setChecked(value.toUInt() != 0); |
172 // CB_mode_Forts->setChecked(value.toUInt() != 0); |
231 return; |
173 return; |
232 } |
174 } |
233 if (param == "DIVIDETEAMS") { |
175 if (param == "DIVIDETEAMS") { |
234 CB_teamsDivide->setChecked(value.toUInt() != 0); |
176 // CB_teamsDivide->setChecked(value.toUInt() != 0); |
235 return; |
177 return; |
236 } |
178 } |
237 if (param == "SOLIDLAND") { |
179 if (param == "SOLIDLAND") { |
238 CB_solid->setChecked(value.toUInt() != 0); |
180 // CB_solid->setChecked(value.toUInt() != 0); |
239 return; |
181 return; |
240 } |
182 } |
241 if (param == "BORDER") { |
183 if (param == "BORDER") { |
242 CB_border->setChecked(value.toUInt() != 0); |
184 // CB_border->setChecked(value.toUInt() != 0); |
243 return; |
185 return; |
244 } |
186 } |
245 if (param == "TEMPLATE") { |
187 if (param == "TEMPLATE") { |
246 pMapContainer->setTemplateFilter(value.toUInt()); |
188 pMapContainer->setTemplateFilter(value.toUInt()); |
247 return; |
189 return; |