author | unc0rr |
Tue, 20 Jun 2006 20:08:17 +0000 | |
changeset 65 | 8c4c6ad6ca99 |
parent 60 | 7fbfa2f13f6f |
child 84 | 0f6669da2fcb |
permissions | -rw-r--r-- |
20 | 1 |
/* |
2 |
* Hedgewars, a worms-like game |
|
3 |
* Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 |
* |
|
5 |
* Distributed under the terms of the BSD-modified licence: |
|
6 |
* |
|
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 |
|
9 |
* with the Software without restriction, including without limitation the |
|
10 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
|
11 |
* sell copies of the Software, and to permit persons to whom the Software is |
|
12 |
* furnished to do so, subject to the following conditions: |
|
13 |
* |
|
14 |
* 1. Redistributions of source code must retain the above copyright notice, |
|
15 |
* this list of conditions and the following disclaimer. |
|
16 |
* 2. Redistributions in binary form must reproduce the above copyright notice, |
|
17 |
* this list of conditions and the following disclaimer in the documentation |
|
18 |
* and/or other materials provided with the distribution. |
|
19 |
* 3. The name of the author may not be used to endorse or promote products |
|
20 |
* derived from this software without specific prior written permission. |
|
21 |
* |
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
|
23 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
24 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
|
25 |
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
26 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
27 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
|
28 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
|
29 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
30 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
|
31 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
32 |
*/ |
|
33 |
||
34 |
#include <QtGui> |
|
35 |
#include <QStringList> |
|
36 |
#include <QProcess> |
|
37 |
#include <QDir> |
|
38 |
#include <QPixmap> |
|
39 |
#include <QRegExp> |
|
40 |
#include <QIcon> |
|
41 |
#include <QFile> |
|
42 |
#include <QTextStream> |
|
43 |
||
44 |
#include "hwform.h" |
|
45 |
#include "sdlkeys.h" |
|
46 |
#include "hwconsts.h" |
|
47 |
||
48 |
HWForm::HWForm(QWidget *parent) |
|
49 |
: QMainWindow(parent) |
|
50 |
{ |
|
51 |
ui.setupUi(this); |
|
52 |
TeamNameEdit = new QLineEdit(ui.GBoxTeam); |
|
53 |
TeamNameEdit->setGeometry(QRect(10, 20, 141, 20)); |
|
54 |
TeamNameEdit->setMaxLength(15); |
|
55 |
for(int i = 0; i < 8; i++) |
|
56 |
{ |
|
57 |
HHNameEdit[i] = new QLineEdit(ui.GBoxHedgehogs); |
|
58 |
HHNameEdit[i]->setGeometry(QRect(10, 20 + i * 30, 141, 20)); |
|
59 |
HHNameEdit[i]->setMaxLength(15); |
|
60 |
} |
|
25 | 61 |
|
20 | 62 |
QStringList binds; |
63 |
for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) |
|
64 |
{ |
|
65 |
binds << sdlkeys[i][1]; |
|
66 |
} |
|
25 | 67 |
|
26 | 68 |
quint16 widind = 0, top = 0; |
69 |
for(quint8 i = 0; i < BINDS_NUMBER; i++) |
|
20 | 70 |
{ |
26 | 71 |
LBind[i] = new QLabel(ui.BindsBox->widget(widind)); |
41 | 72 |
LBind[i]->setGeometry(QRect(10, top + 3, 70, 20)); |
20 | 73 |
LBind[i]->setText(cbinds[i].name); |
74 |
LBind[i]->setAlignment(Qt::AlignRight); |
|
26 | 75 |
CBBind[i] = new QComboBox(ui.BindsBox->widget(widind)); |
41 | 76 |
CBBind[i]->setGeometry(QRect(90, top, 80, 20)); |
20 | 77 |
CBBind[i]->addItems(binds); |
26 | 78 |
if (cbinds[i].chwidget) |
79 |
{ |
|
80 |
top = 0; |
|
81 |
widind++; |
|
82 |
} else |
|
83 |
{ |
|
41 | 84 |
top += 28; |
26 | 85 |
} |
20 | 86 |
} |
25 | 87 |
|
20 | 88 |
QDir tmpdir; |
89 |
tmpdir.cd(DATA_PATH); |
|
90 |
tmpdir.cd("Forts"); |
|
91 |
tmpdir.setFilter(QDir::Files); |
|
25 | 92 |
|
20 | 93 |
ui.CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L.png"), "\\1")); |
25 | 94 |
|
20 | 95 |
tmpdir.cd("../Graphics/Graves"); |
96 |
QStringList list = tmpdir.entryList(QStringList("*.png")); |
|
97 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
98 |
{ |
|
99 |
ui.CBGrave->addItem((*it).replace(QRegExp("^(.*).png"), "\\1")); |
|
100 |
} |
|
101 |
||
102 |
cfgdir.setPath(cfgdir.homePath()); |
|
103 |
if (!cfgdir.exists(".hedgewars")) |
|
104 |
{ |
|
105 |
if (!cfgdir.mkdir(".hedgewars")) |
|
106 |
{ |
|
25 | 107 |
QMessageBox::critical(this, |
20 | 108 |
tr("Error"), |
43 | 109 |
tr("Cannot create directory %1").arg("/.hedgewars"), |
20 | 110 |
tr("Quit")); |
34 | 111 |
return ; |
20 | 112 |
} |
113 |
} |
|
114 |
cfgdir.cd(".hedgewars"); |
|
25 | 115 |
|
21 | 116 |
list = cfgdir.entryList(QStringList("*.cfg")); |
44 | 117 |
|
118 |
if(list.empty()) { |
|
119 |
HWTeam defaultTeam("DefaultTeam"); |
|
120 |
defaultTeam.SetCfgDir(cfgdir.absolutePath()); |
|
121 |
defaultTeam.SaveToFile(); |
|
122 |
list.push_back("DefaultTeam"); |
|
123 |
} |
|
124 |
||
60
7fbfa2f13f6f
vector removed & teamselwidget moved to constructor
displacer
parents:
52
diff
changeset
|
125 |
pts=new TeamSelWidget(ui.Pages->widget(ID_PAGE_SINGLEPLAYER)); |
7fbfa2f13f6f
vector removed & teamselwidget moved to constructor
displacer
parents:
52
diff
changeset
|
126 |
|
21 | 127 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
128 |
{ |
|
50 | 129 |
QString tmpTeamStr=(*it).replace(QRegExp("^(.*).cfg$"), "\\1"); |
60
7fbfa2f13f6f
vector removed & teamselwidget moved to constructor
displacer
parents:
52
diff
changeset
|
130 |
pts->addTeam(tmpTeamStr); |
50 | 131 |
ui.CBTeamName->addItem(tmpTeamStr); |
21 | 132 |
} |
25 | 133 |
|
20 | 134 |
QFile settings(cfgdir.absolutePath() + "/options"); |
25 | 135 |
if (settings.open(QIODevice::ReadOnly)) |
20 | 136 |
{ |
25 | 137 |
QTextStream stream(&settings); |
138 |
stream.setCodec("UTF-8"); |
|
139 |
QString str; |
|
140 |
||
141 |
while (!stream.atEnd()) |
|
20 | 142 |
{ |
25 | 143 |
str = stream.readLine(); |
144 |
if (str.startsWith(";")) continue; |
|
145 |
if (str.startsWith("resolution ")) |
|
146 |
{ |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
147 |
ui.CBResolution->setCurrentIndex(str.mid(11).toLong()); |
25 | 148 |
} else |
149 |
if (str.startsWith("fullscreen ")) |
|
150 |
{ |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
151 |
ui.CBFullscreen->setChecked(str.mid(11).toLong()); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
152 |
} else |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
153 |
if (str.startsWith("nick ")) |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
154 |
{ |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
155 |
ui.editNetNick->setText(str.mid(5)); |
25 | 156 |
} |
20 | 157 |
} |
25 | 158 |
settings.close(); |
20 | 159 |
} |
26 | 160 |
|
28 | 161 |
connect(ui.BtnSPBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
162 |
connect(ui.BtnDemosBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
|
163 |
connect(ui.BtnSetupBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
|
164 |
connect(ui.BtnMPBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
|
165 |
connect(ui.BtnNetBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
|
166 |
connect(ui.BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer())); |
|
167 |
connect(ui.BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup())); |
|
168 |
connect(ui.BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer())); |
|
169 |
connect(ui.BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos())); |
|
170 |
connect(ui.BtnNet, SIGNAL(clicked()), this, SLOT(GoToNet())); |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
171 |
connect(ui.BtnNetCFGBack, SIGNAL(clicked()), this, SLOT(GoToNetChat())); |
28 | 172 |
connect(ui.BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam())); |
173 |
connect(ui.BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam())); |
|
174 |
connect(ui.BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave())); |
|
175 |
connect(ui.BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard())); |
|
176 |
connect(ui.BtnSimpleGame, SIGNAL(clicked()), this, SLOT(SimpleGame())); |
|
177 |
connect(ui.BtnSaveOptions, SIGNAL(clicked()), this, SLOT(SaveOptions())); |
|
178 |
connect(ui.BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo())); |
|
179 |
connect(ui.BtnNetConnect, SIGNAL(clicked()), this, SLOT(NetConnect())); |
|
180 |
connect(ui.BtnNetChatDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect())); |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
181 |
connect(ui.BtnNetChatJoin, SIGNAL(clicked()), this, SLOT(NetJoin())); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
182 |
connect(ui.BtnNetChatCreate, SIGNAL(clicked()), this, SLOT(NetCreate())); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
183 |
connect(ui.BtnNetCFGAddTeam, SIGNAL(clicked()), this, SLOT(NetAddTeam())); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
184 |
connect(ui.BtnNetCFGGo, SIGNAL(clicked()), this, SLOT(NetStartGame())); |
28 | 185 |
connect(ui.CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &))); |
186 |
connect(ui.CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
|
20 | 187 |
ui.Pages->setCurrentIndex(ID_PAGE_MAIN); |
188 |
} |
|
189 |
||
190 |
void HWForm::GoToMain() |
|
191 |
{ |
|
192 |
ui.Pages->setCurrentIndex(ID_PAGE_MAIN); |
|
193 |
} |
|
194 |
||
195 |
void HWForm::GoToSinglePlayer() |
|
196 |
{ |
|
197 |
ui.Pages->setCurrentIndex(ID_PAGE_SINGLEPLAYER); |
|
50 | 198 |
|
199 |
pts->resize(500, 350); |
|
200 |
pts->show(); |
|
20 | 201 |
} |
202 |
||
203 |
void HWForm::GoToSetup() |
|
204 |
{ |
|
205 |
ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
|
206 |
} |
|
207 |
||
25 | 208 |
void HWForm::GoToMultiplayer() |
209 |
{ |
|
210 |
ui.Pages->setCurrentIndex(ID_PAGE_MULTIPLAYER); |
|
211 |
} |
|
26 | 212 |
|
213 |
void HWForm::GoToDemos() |
|
214 |
{ |
|
215 |
QDir tmpdir; |
|
216 |
tmpdir.cd(DATA_PATH); |
|
217 |
tmpdir.cd("Demos"); |
|
218 |
tmpdir.setFilter(QDir::Files); |
|
28 | 219 |
ui.DemosList->clear(); |
26 | 220 |
ui.DemosList->addItems(tmpdir.entryList(QStringList("*.hwd_1")).replaceInStrings(QRegExp("^(.*).hwd_1"), "\\1")); |
221 |
ui.Pages->setCurrentIndex(ID_PAGE_DEMOS); |
|
222 |
} |
|
223 |
||
28 | 224 |
void HWForm::GoToNet() |
225 |
{ |
|
226 |
ui.Pages->setCurrentIndex(ID_PAGE_NET); |
|
227 |
} |
|
228 |
||
229 |
void HWForm::GoToNetChat() |
|
230 |
{ |
|
231 |
ui.Pages->setCurrentIndex(ID_PAGE_NETCHAT); |
|
232 |
} |
|
233 |
||
20 | 234 |
void HWForm::NewTeam() |
235 |
{ |
|
25 | 236 |
tmpTeam = new HWTeam("unnamed"); |
21 | 237 |
tmpTeam->SetCfgDir(cfgdir.absolutePath()); |
238 |
tmpTeam->SetToPage(this); |
|
20 | 239 |
ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM); |
240 |
} |
|
241 |
||
242 |
void HWForm::EditTeam() |
|
243 |
{ |
|
25 | 244 |
tmpTeam = new HWTeam(ui.CBTeamName->currentText()); |
21 | 245 |
tmpTeam->SetCfgDir(cfgdir.absolutePath()); |
246 |
tmpTeam->LoadFromFile(); |
|
247 |
tmpTeam->SetToPage(this); |
|
20 | 248 |
ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM); |
249 |
} |
|
250 |
||
251 |
void HWForm::TeamSave() |
|
252 |
{ |
|
21 | 253 |
tmpTeam->GetFromPage(this); |
254 |
tmpTeam->SaveToFile(); |
|
255 |
delete tmpTeam; |
|
20 | 256 |
ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
257 |
} |
|
258 |
||
259 |
void HWForm::TeamDiscard() |
|
260 |
{ |
|
261 |
ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
|
262 |
} |
|
263 |
||
264 |
void HWForm::SimpleGame() |
|
265 |
{ |
|
26 | 266 |
game = new HWGame(ui.CBResolution->currentIndex(), ui.CBFullscreen->isChecked()); |
45
1072e7fe85c8
DefaultTeam is now default to play with single and network game
displacer
parents:
44
diff
changeset
|
267 |
game->AddTeam("DefaultTeam"); |
1072e7fe85c8
DefaultTeam is now default to play with single and network game
displacer
parents:
44
diff
changeset
|
268 |
game->AddTeam("DefaultTeam"); |
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
269 |
game->StartLocal(); |
20 | 270 |
} |
271 |
||
272 |
void HWForm::CBGrave_activated(const QString & gravename) |
|
273 |
{ |
|
274 |
QPixmap pix(QString(DATA_PATH) + "/Graphics/Graves/" + gravename + ".png"); |
|
275 |
ui.GravePreview->setPixmap(pix.copy(0, 0, 32, 32)); |
|
276 |
} |
|
277 |
||
278 |
void HWForm::CBFort_activated(const QString & fortname) |
|
279 |
{ |
|
280 |
QPixmap pix(QString(DATA_PATH) + "/Forts/" + fortname + "L.png"); |
|
281 |
ui.FortPreview->setPixmap(pix); |
|
282 |
} |
|
283 |
||
284 |
void HWForm::SaveOptions() |
|
285 |
{ |
|
286 |
QFile settings(cfgdir.absolutePath() + "/options"); |
|
287 |
if (!settings.open(QIODevice::WriteOnly)) |
|
288 |
{ |
|
25 | 289 |
QMessageBox::critical(this, |
20 | 290 |
tr("Error"), |
43 | 291 |
tr("Cannot save options to file %1").arg(settings.fileName()), |
20 | 292 |
tr("Quit")); |
293 |
return ; |
|
294 |
} |
|
295 |
QTextStream stream(&settings); |
|
296 |
stream.setCodec("UTF-8"); |
|
297 |
stream << "; Generated by Hedgewars, do not modify" << endl; |
|
298 |
stream << "resolution " << ui.CBResolution->currentIndex() << endl; |
|
299 |
stream << "fullscreen " << ui.CBFullscreen->isChecked() << endl; |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
300 |
stream << "nick " << ui.editNetNick->text() << endl; |
20 | 301 |
settings.close(); |
302 |
} |
|
26 | 303 |
|
304 |
void HWForm::PlayDemo() |
|
305 |
{ |
|
306 |
QListWidgetItem * curritem = ui.DemosList->currentItem(); |
|
307 |
if (!curritem) |
|
308 |
{ |
|
309 |
QMessageBox::critical(this, |
|
310 |
tr("Error"), |
|
311 |
tr("Please, select demo from the list above"), |
|
312 |
tr("OK")); |
|
313 |
return ; |
|
314 |
} |
|
315 |
game = new HWGame(ui.CBResolution->currentIndex(), ui.CBFullscreen->isChecked()); |
|
316 |
game->PlayDemo(QString(DATA_PATH) + "/Demos/" + curritem->text() + ".hwd_1"); |
|
317 |
} |
|
318 |
||
28 | 319 |
void HWForm::NetConnect() |
320 |
{ |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
321 |
hwnet = new HWNet(ui.CBResolution->currentIndex(), ui.CBFullscreen->isChecked()); |
28 | 322 |
connect(hwnet, SIGNAL(Connected()), this, SLOT(GoToNetChat())); |
323 |
connect(hwnet, SIGNAL(AddGame(const QString &)), this, SLOT(AddGame(const QString &))); |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
324 |
connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter())); |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
325 |
connect(hwnet, SIGNAL(ChangeInTeams(const QStringList &)), this, SLOT(ChangeInNetTeams(const QStringList &))); |
36 | 326 |
hwnet->Connect("172.19.5.168", 6667, ui.editNetNick->text()); |
28 | 327 |
} |
26 | 328 |
|
28 | 329 |
void HWForm::NetDisconnect() |
330 |
{ |
|
331 |
hwnet->Disconnect(); |
|
332 |
GoToNet(); |
|
333 |
} |
|
334 |
||
335 |
void HWForm::AddGame(const QString & chan) |
|
336 |
{ |
|
337 |
ui.ChannelsList->addItem(chan); |
|
338 |
} |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
339 |
|
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
340 |
void HWForm::NetGameEnter() |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
341 |
{ |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
342 |
ui.Pages->setCurrentIndex(ID_PAGE_NETCFG); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
343 |
} |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
344 |
|
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
345 |
void HWForm::NetJoin() |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
346 |
{ |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
347 |
hwnet->JoinGame("#hw"); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
348 |
} |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
349 |
|
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
350 |
void HWForm::NetCreate() |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
351 |
{ |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
352 |
hwnet->JoinGame("#hw"); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
353 |
} |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
354 |
|
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
355 |
void HWForm::NetAddTeam() |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
356 |
{ |
45
1072e7fe85c8
DefaultTeam is now default to play with single and network game
displacer
parents:
44
diff
changeset
|
357 |
HWTeam team("DefaultTeam"); |
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
358 |
team.SetCfgDir(cfgdir.absolutePath()); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
359 |
team.LoadFromFile(); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
360 |
hwnet->AddTeam(team); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
361 |
} |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
362 |
|
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
363 |
void HWForm::NetStartGame() |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
364 |
{ |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
365 |
hwnet->StartGame(); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
366 |
} |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
367 |
|
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
368 |
void HWForm::ChangeInNetTeams(const QStringList & teams) |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
369 |
{ |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
370 |
ui.listNetTeams->clear(); |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
371 |
ui.listNetTeams->addItems(teams); |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
372 |
} |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
373 |