QTfrontend/gamecfgwidget.cpp
changeset 1873 815a3ff1fe4b
parent 1802 dd148e2506e2
child 1874 1b145e099b75
equal deleted inserted replaced
1872:abfce825a14f 1873:815a3ff1fe4b
   177 		sl.append("emap " + currentMap);
   177 		sl.append("emap " + currentMap);
   178 	sl.append("etheme " + getCurrentTheme());
   178 	sl.append("etheme " + getCurrentTheme());
   179 	return sl;
   179 	return sl;
   180 }
   180 }
   181 
   181 
   182 void GameCFGWidget::setSeed(const QString & seed)
       
   183 {
       
   184 	pMapContainer->setSeed(seed);
       
   185 }
       
   186 
       
   187 void GameCFGWidget::setMap(const QString & map)
       
   188 {
       
   189 	pMapContainer->setMap(map);
       
   190 }
       
   191 
       
   192 void GameCFGWidget::setTheme(const QString & theme)
       
   193 {
       
   194 	pMapContainer->setTheme(theme);
       
   195 }
       
   196 
       
   197 void GameCFGWidget::setInitHealth(int health)
       
   198 {
       
   199 	SB_InitHealth->setValue(health);
       
   200 }
       
   201 
       
   202 void GameCFGWidget::setTurnTime(int time)
       
   203 {
       
   204 	SB_TurnTime->setValue(time);
       
   205 }
       
   206 
       
   207 void GameCFGWidget::setSuddenDeathTurns(int turns)
       
   208 {
       
   209 	SB_SuddenDeath->setValue(turns);
       
   210 }
       
   211 
       
   212 void GameCFGWidget::setCaseProbability(int prob)
       
   213 {
       
   214 	SB_CaseProb->setValue(prob);
       
   215 }
       
   216 
       
   217 void GameCFGWidget::setFortsMode(bool value)
       
   218 {
       
   219 	CB_mode_Forts->setChecked(value);
       
   220 }
       
   221 
       
   222 void GameCFGWidget::setTeamsDivide(bool value)
       
   223 {
       
   224 	CB_teamsDivide->setChecked(value);
       
   225 }
       
   226 
       
   227 void GameCFGWidget::setSolid(bool value)
       
   228 {
       
   229 	CB_solid->setChecked(value);
       
   230 }
       
   231 
       
   232 void GameCFGWidget::setBorder(bool value)
       
   233 {
       
   234 	CB_border->setChecked(value);
       
   235 }
       
   236 
       
   237 void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo)
   182 void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo)
   238 {
   183 {
   239 	if (ammo.size() != cDefaultAmmoStore->size())
   184 	if (ammo.size() != cDefaultAmmoStore->size())
   240 		QMessageBox::critical(this, tr("Error"), tr("Illegal ammo scheme"));
   185 		QMessageBox::critical(this, tr("Error"), tr("Illegal ammo scheme"));
   241 
   186 
   252 void GameCFGWidget::ammoChanged(int index)
   197 void GameCFGWidget::ammoChanged(int index)
   253 {
   198 {
   254 	if (index >= 0)
   199 	if (index >= 0)
   255 		emit newWeaponScheme(WeaponsName->itemText(index), WeaponsName->itemData(index).toString());
   200 		emit newWeaponScheme(WeaponsName->itemText(index), WeaponsName->itemData(index).toString());
   256 }
   201 }
       
   202 
       
   203 void GameCFGWidget::setParam(const QString & param, const QStringList & slValue)
       
   204 {
       
   205 	if (slValue.size() == 1)
       
   206 	{
       
   207 		QString value = slValue[0];
       
   208 		if (param == "MAP") {
       
   209 			pMapContainer->setMap(value);
       
   210 			return;
       
   211 		}
       
   212 		if (param == "SEED") {
       
   213 			pMapContainer->setSeed(value);
       
   214 			return;
       
   215 		}
       
   216 		if (param == "THEME") {
       
   217 			pMapContainer->setTheme(value);
       
   218 			return;
       
   219 		}
       
   220 		if (param == "HEALTH") {
       
   221 			SB_InitHealth->setValue(value.toUInt());
       
   222 			return;
       
   223 		}
       
   224 		if (param == "TURNTIME") {
       
   225 			SB_TurnTime->setValue(value.toUInt());
       
   226 			return;
       
   227 		}
       
   228 		if (param == "SD_TURNS") {
       
   229 			SB_SuddenDeath->setValue(value.toUInt());
       
   230 			return;
       
   231 		}
       
   232 		if (param == "CASEFACTOR") {
       
   233 			SB_CaseProb->setValue(value.toUInt());
       
   234 			return;
       
   235 		}
       
   236 		if (param == "FORTSMODE") {
       
   237 			CB_mode_Forts->setChecked(value.toUInt() != 0);
       
   238 			return;
       
   239 		}
       
   240 		if (param == "DIVIDETEAMS") {
       
   241 			CB_teamsDivide->setChecked(value.toUInt() != 0);
       
   242 			return;
       
   243 		}
       
   244 		if (param == "SOLIDLAND") {
       
   245 			CB_solid->setChecked(value.toUInt() != 0);
       
   246 			return;
       
   247 		}
       
   248 		if (param == "BORDER") {
       
   249 			CB_border->setChecked(value.toUInt() != 0);
       
   250 			return;
       
   251 		}
       
   252 /*		if (param == "TEMPLATE_FILTER") {
       
   253 			emit templateFilterChanged(lst[2].toUInt());
       
   254 			return;
       
   255 		}
       
   256 */	}
       
   257 
       
   258 	if (slValue.size() == 2)
       
   259 	{
       
   260 		if (param == "AMMO") {
       
   261 			setNetAmmo(slValue[0], slValue[1]);
       
   262 			return;
       
   263 		}
       
   264 	}
       
   265 }
       
   266