1 /* |
1 /* |
2 * Hedgewars, a worms-like game |
2 * Hedgewars, a worms-like game |
3 * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com> |
3 * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com> |
4 * |
4 * |
5 * Distributed under the terms of the BSD-modified licence: |
5 * Distributed under the terms of the BSD-modified licence: |
6 * |
6 * |
7 * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 * Permission is hereby granted, free of charge, to any person obtaining a copy |
8 * of this software and associated documentation files (the "Software"), to deal |
8 * of this software and associated documentation files (the "Software"), to deal |
98 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
98 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
99 { |
99 { |
100 ui.CBGrave->addItem((*it).replace(QRegExp("^(.*).png"), "\\1")); |
100 ui.CBGrave->addItem((*it).replace(QRegExp("^(.*).png"), "\\1")); |
101 } |
101 } |
102 |
102 |
103 config = new GameConfig(this); |
103 config = new GameUIConfig(this); |
104 |
104 |
105 QStringList teamslist = config->GetTeamsList(); |
105 QStringList teamslist = config->GetTeamsList(); |
106 |
106 |
107 if(teamslist.empty()) { |
107 if(teamslist.empty()) { |
108 HWTeam defaultTeam("DefaultTeam"); |
108 HWTeam defaultTeam("DefaultTeam"); |
109 defaultTeam.SetCfgDir(config->cfgdir.absolutePath()); |
109 defaultTeam.SetCfgDir(config->cfgdir.absolutePath()); |
110 defaultTeam.SaveToFile(); |
110 defaultTeam.SaveToFile(); |
111 teamslist.push_back("DefaultTeam"); |
111 teamslist.push_back("DefaultTeam"); |
112 } |
112 } |
113 |
113 |
114 pts=new TeamSelWidget(ui.Pages->widget(ID_PAGE_SINGLEPLAYER)); |
|
115 |
|
116 for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it ) |
114 for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it ) |
117 { |
115 { |
118 QString tmpTeamStr=(*it).replace(QRegExp("^(.*).cfg$"), "\\1"); |
116 QString tmpTeamStr=(*it).replace(QRegExp("^(.*).cfg$"), "\\1"); |
119 pts->addTeam(tmpTeamStr); |
117 ui.PageLGTeamsSelect->addTeam(tmpTeamStr); |
120 ui.CBTeamName->addItem(tmpTeamStr); |
118 ui.CBTeamName->addItem(tmpTeamStr); |
121 } |
119 } |
122 |
120 |
123 connect(ui.BtnSPBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
121 connect(ui.BtnSPBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
124 connect(ui.BtnDemosBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
122 connect(ui.BtnDemosBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
223 ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
218 ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
224 } |
219 } |
225 |
220 |
226 void HWForm::SimpleGame() |
221 void HWForm::SimpleGame() |
227 { |
222 { |
228 game = new HWGame(config); |
223 game = new HWGame(config, ui.pageLGGameCFG); |
229 game->AddTeam("DefaultTeam"); |
224 game->AddTeam("DefaultTeam"); |
230 game->AddTeam("DefaultTeam"); |
225 game->AddTeam("DefaultTeam"); |
231 game->StartLocal(); |
226 game->StartLocal(); |
232 } |
227 } |
233 |
228 |
252 tr("Error"), |
247 tr("Error"), |
253 tr("Please, select demo from the list above"), |
248 tr("Please, select demo from the list above"), |
254 tr("OK")); |
249 tr("OK")); |
255 return ; |
250 return ; |
256 } |
251 } |
257 game = new HWGame(config); |
252 game = new HWGame(config, 0); |
258 game->PlayDemo(QString(DATA_PATH) + "/Demos/" + curritem->text() + ".hwd_1"); |
253 game->PlayDemo(QString(DATA_PATH) + "/Demos/" + curritem->text() + ".hwd_1"); |
259 } |
254 } |
260 |
255 |
261 void HWForm::NetConnect() |
256 void HWForm::NetConnect() |
262 { |
257 { |