QTfrontend/hwform.cpp
changeset 341 184230eb4151
parent 339 7535ab6c3820
child 347 6521e1b2cd40
equal deleted inserted replaced
340:f5d4db927eba 341:184230eb4151
   215 	GoBack();
   215 	GoBack();
   216 }
   216 }
   217 
   217 
   218 void HWForm::SimpleGame()
   218 void HWForm::SimpleGame()
   219 {
   219 {
   220 	CreateGame(ui.pageLocalGame->gameCFG);
   220 	CreateGame(ui.pageLocalGame->gameCFG, 0);
   221 	game->StartQuick();
   221 	game->StartQuick();
   222 }
   222 }
   223 
   223 
   224 void HWForm::PlayDemo()
   224 void HWForm::PlayDemo()
   225 {
   225 {
   230 				tr("Error"),
   230 				tr("Error"),
   231 				tr("Please, select demo from the list above"),
   231 				tr("Please, select demo from the list above"),
   232 				tr("OK"));
   232 				tr("OK"));
   233 		return ;
   233 		return ;
   234 	}
   234 	}
   235 	CreateGame(0);
   235 	CreateGame(0, 0);
   236 	game->PlayDemo(cfgdir->absolutePath() + "/Demos/" + curritem->text() + ".hwd_" + cProtoVer);
   236 	game->PlayDemo(cfgdir->absolutePath() + "/Demos/" + curritem->text() + ".hwd_" + cProtoVer);
   237 }
   237 }
   238 
   238 
   239 void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick)
   239 void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick)
   240 {
   240 {
   319   ui.pageNetGame->pNetTeamsWidget->addTeam(team);
   319   ui.pageNetGame->pNetTeamsWidget->addTeam(team);
   320 }
   320 }
   321 
   321 
   322 void HWForm::StartMPGame()
   322 void HWForm::StartMPGame()
   323 {
   323 {
   324 	CreateGame(ui.pageMultiplayer->gameCFG);
   324 	CreateGame(ui.pageMultiplayer->gameCFG, ui.pageMultiplayer->teamsSelect);
   325 
   325 
   326 	list<HWTeam> teamslist=ui.pageMultiplayer->teamsSelect->getPlayingTeams();
       
   327 	for (list<HWTeam>::const_iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
       
   328 	  HWTeamTempParams params=ui.pageMultiplayer->teamsSelect->getTeamParams(it->TeamName);
       
   329 	  game->AddTeam(it->TeamName, params);
       
   330 	}
       
   331 	game->StartLocal();
   326 	game->StartLocal();
   332 }
   327 }
   333 
   328 
   334 void HWForm::GameStateChanged(GameState gameState)
   329 void HWForm::GameStateChanged(GameState gameState)
   335 {
   330 {
   373 			break;
   368 			break;
   374 		}
   369 		}
   375 	}
   370 	}
   376 }
   371 }
   377 
   372 
   378 void HWForm::CreateGame(GameCFGWidget * gamecfg)
   373 void HWForm::CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget)
   379 {
   374 {
   380 	game = new HWGame(config, gamecfg);
   375 	game = new HWGame(config, gamecfg, pTeamSelWidget);
   381 	connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState)));
   376 	connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState)));
   382 	connect(game, SIGNAL(GameStats(char, const QString &)), this, SLOT(GameStats(char, const QString &)));
   377 	connect(game, SIGNAL(GameStats(char, const QString &)), this, SLOT(GameStats(char, const QString &)));
   383 }
   378 }