168 quint32 GameCFGWidget::getInitHealth() const |
169 quint32 GameCFGWidget::getInitHealth() const |
169 { |
170 { |
170 return schemeData(26).toInt(); |
171 return schemeData(26).toInt(); |
171 } |
172 } |
172 |
173 |
173 QStringList GameCFGWidget::getFullConfig() const |
174 QByteArray GameCFGWidget::getFullConfig() const |
174 { |
175 { |
175 QStringList sl; |
176 QList<QByteArray> bcfg; |
176 int mapgen = pMapContainer->get_mapgen(); |
177 int mapgen = pMapContainer->get_mapgen(); |
177 |
178 |
178 sl.append("eseed " + pMapContainer->getCurrentSeed()); |
179 bcfg << QString("eseed " + pMapContainer->getCurrentSeed()).toUtf8(); |
179 sl.append(QString("e$gmflags %1").arg(getGameFlags())); |
180 bcfg << QString("e$gmflags %1").arg(getGameFlags()).toUtf8(); |
180 sl.append(QString("e$damagepct %1").arg(schemeData(24).toInt())); |
181 bcfg << QString("e$damagepct %1").arg(schemeData(24).toInt()).toUtf8(); |
181 sl.append(QString("e$turntime %1").arg(schemeData(25).toInt() * 1000)); |
182 bcfg << QString("e$turntime %1").arg(schemeData(25).toInt() * 1000).toUtf8(); |
182 sl.append(QString("e$sd_turns %1").arg(schemeData(27).toInt())); |
183 bcfg << QString("e$sd_turns %1").arg(schemeData(27).toInt()).toUtf8(); |
183 sl.append(QString("e$casefreq %1").arg(schemeData(28).toInt())); |
184 bcfg << QString("e$casefreq %1").arg(schemeData(28).toInt()).toUtf8(); |
184 sl.append(QString("e$minestime %1").arg(schemeData(29).toInt() * 1000)); |
185 bcfg << QString("e$minestime %1").arg(schemeData(29).toInt() * 1000).toUtf8(); |
185 sl.append(QString("e$minesnum %1").arg(schemeData(30).toInt())); |
186 bcfg << QString("e$minesnum %1").arg(schemeData(30).toInt()).toUtf8(); |
186 sl.append(QString("e$minedudpct %1").arg(schemeData(31).toInt())); |
187 bcfg << QString("e$minedudpct %1").arg(schemeData(31).toInt()).toUtf8(); |
187 sl.append(QString("e$explosives %1").arg(schemeData(32).toInt())); |
188 bcfg << QString("e$explosives %1").arg(schemeData(32).toInt()).toUtf8(); |
188 sl.append(QString("e$healthprob %1").arg(schemeData(33).toInt())); |
189 bcfg << QString("e$healthprob %1").arg(schemeData(33).toInt()).toUtf8(); |
189 sl.append(QString("e$hcaseamount %1").arg(schemeData(34).toInt())); |
190 bcfg << QString("e$hcaseamount %1").arg(schemeData(34).toInt()).toUtf8(); |
190 sl.append(QString("e$waterrise %1").arg(schemeData(35).toInt())); |
191 bcfg << QString("e$waterrise %1").arg(schemeData(35).toInt()).toUtf8(); |
191 sl.append(QString("e$healthdec %1").arg(schemeData(36).toInt())); |
192 bcfg << QString("e$healthdec %1").arg(schemeData(36).toInt()).toUtf8(); |
192 sl.append(QString("e$ropepct %1").arg(schemeData(37).toInt())); |
193 bcfg << QString("e$ropepct %1").arg(schemeData(37).toInt()).toUtf8(); |
193 sl.append(QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter())); |
194 bcfg << QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()).toUtf8(); |
194 sl.append(QString("e$mapgen %1").arg(mapgen)); |
195 bcfg << QString("e$mapgen %1").arg(mapgen).toUtf8(); |
195 |
196 |
196 switch (mapgen) |
197 switch (mapgen) |
197 { |
198 { |
198 case MAPGEN_MAZE: |
199 case MAPGEN_MAZE: |
199 sl.append(QString("e$maze_size %1").arg(pMapContainer->get_maze_size())); |
200 bcfg << QString("e$maze_size %1").arg(pMapContainer->get_maze_size()).toUtf8(); |
200 |
201 |
201 case MAPGEN_DRAWN: |
202 case MAPGEN_DRAWN: |
202 { |
203 { |
203 QByteArray data = pMapContainer->getDrawnMapData(); |
204 QByteArray data = pMapContainer->getDrawnMapData(); |
204 while(data.size() > 0) |
205 while(data.size() > 0) |
205 { |
206 { |
206 QByteArray tmp = data; |
207 QByteArray tmp = data; |
207 tmp.truncate(230); |
208 tmp.truncate(200); |
208 sl << QString("edraw %1").arg(QString(tmp)); |
209 tmp.prepend("edraw "); |
209 data.remove(0, 230); |
210 bcfg << tmp; |
|
211 data.remove(0, 200); |
210 } |
212 } |
211 } |
213 } |
212 default: ; |
214 default: ; |
213 } |
215 } |
214 |
216 |
215 QString currentMap = pMapContainer->getCurrentMap(); |
217 QString currentMap = pMapContainer->getCurrentMap(); |
216 if (currentMap.size() > 0) |
218 if (currentMap.size() > 0) |
217 { |
219 { |
218 sl.append("emap " + currentMap); |
220 bcfg << QString("emap " + currentMap).toUtf8(); |
219 if(pMapContainer->getCurrentIsMission()) |
221 if(pMapContainer->getCurrentIsMission()) |
220 sl.append(QString("escript Maps/%1/map.lua") |
222 bcfg << QString("escript Maps/%1/map.lua").arg(currentMap).toUtf8(); |
221 .arg(currentMap)); |
223 } |
222 } |
224 bcfg << QString("etheme " + pMapContainer->getCurrentTheme()).toUtf8(); |
223 sl.append("etheme " + pMapContainer->getCurrentTheme()); |
225 |
224 return sl; |
226 QByteArray result; |
|
227 |
|
228 foreach(QByteArray ba, bcfg) |
|
229 HWProto::addByteArrayToBuffer(result, ba); |
|
230 |
|
231 return result; |
225 } |
232 } |
226 |
233 |
227 void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo) |
234 void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo) |
228 { |
235 { |
229 bool illegal = ammo.size() != cDefaultAmmoStore->size(); |
236 bool illegal = ammo.size() != cDefaultAmmoStore->size(); |