author | unc0rr |
Wed, 01 Feb 2006 20:42:53 +0000 | |
changeset 57 | e1a77ae57065 |
parent 52 | ae2950c5465c |
child 60 | 7fbfa2f13f6f |
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" |
|
50 | 47 |
#include "teamselect.h" |
20 | 48 |
|
49 |
HWForm::HWForm(QWidget *parent) |
|
50 |
: QMainWindow(parent) |
|
51 |
{ |
|
52 |
ui.setupUi(this); |
|
53 |
TeamNameEdit = new QLineEdit(ui.GBoxTeam); |
|
54 |
TeamNameEdit->setGeometry(QRect(10, 20, 141, 20)); |
|
55 |
TeamNameEdit->setMaxLength(15); |
|
56 |
for(int i = 0; i < 8; i++) |
|
57 |
{ |
|
58 |
HHNameEdit[i] = new QLineEdit(ui.GBoxHedgehogs); |
|
59 |
HHNameEdit[i]->setGeometry(QRect(10, 20 + i * 30, 141, 20)); |
|
60 |
HHNameEdit[i]->setMaxLength(15); |
|
61 |
} |
|
25 | 62 |
|
20 | 63 |
QStringList binds; |
64 |
for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) |
|
65 |
{ |
|
66 |
binds << sdlkeys[i][1]; |
|
67 |
} |
|
25 | 68 |
|
26 | 69 |
quint16 widind = 0, top = 0; |
70 |
for(quint8 i = 0; i < BINDS_NUMBER; i++) |
|
20 | 71 |
{ |
26 | 72 |
LBind[i] = new QLabel(ui.BindsBox->widget(widind)); |
41 | 73 |
LBind[i]->setGeometry(QRect(10, top + 3, 70, 20)); |
20 | 74 |
LBind[i]->setText(cbinds[i].name); |
75 |
LBind[i]->setAlignment(Qt::AlignRight); |
|
26 | 76 |
CBBind[i] = new QComboBox(ui.BindsBox->widget(widind)); |
41 | 77 |
CBBind[i]->setGeometry(QRect(90, top, 80, 20)); |
20 | 78 |
CBBind[i]->addItems(binds); |
26 | 79 |
if (cbinds[i].chwidget) |
80 |
{ |
|
81 |
top = 0; |
|
82 |
widind++; |
|
83 |
} else |
|
84 |
{ |
|
41 | 85 |
top += 28; |
26 | 86 |
} |
20 | 87 |
} |
25 | 88 |
|
20 | 89 |
QDir tmpdir; |
90 |
tmpdir.cd(DATA_PATH); |
|
91 |
tmpdir.cd("Forts"); |
|
92 |
tmpdir.setFilter(QDir::Files); |
|
25 | 93 |
|
20 | 94 |
ui.CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L.png"), "\\1")); |
25 | 95 |
|
20 | 96 |
tmpdir.cd("../Graphics/Graves"); |
97 |
QStringList list = tmpdir.entryList(QStringList("*.png")); |
|
98 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
99 |
{ |
|
100 |
ui.CBGrave->addItem((*it).replace(QRegExp("^(.*).png"), "\\1")); |
|
101 |
} |
|
102 |
||
103 |
cfgdir.setPath(cfgdir.homePath()); |
|
104 |
if (!cfgdir.exists(".hedgewars")) |
|
105 |
{ |
|
106 |
if (!cfgdir.mkdir(".hedgewars")) |
|
107 |
{ |
|
25 | 108 |
QMessageBox::critical(this, |
20 | 109 |
tr("Error"), |
43 | 110 |
tr("Cannot create directory %1").arg("/.hedgewars"), |
20 | 111 |
tr("Quit")); |
34 | 112 |
return ; |
20 | 113 |
} |
114 |
} |
|
115 |
cfgdir.cd(".hedgewars"); |
|
25 | 116 |
|
21 | 117 |
list = cfgdir.entryList(QStringList("*.cfg")); |
44 | 118 |
|
119 |
if(list.empty()) { |
|
120 |
HWTeam defaultTeam("DefaultTeam"); |
|
121 |
defaultTeam.SetCfgDir(cfgdir.absolutePath()); |
|
122 |
defaultTeam.SaveToFile(); |
|
123 |
list.push_back("DefaultTeam"); |
|
124 |
} |
|
125 |
||
21 | 126 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
127 |
{ |
|
50 | 128 |
QString tmpTeamStr=(*it).replace(QRegExp("^(.*).cfg$"), "\\1"); |
129 |
m_teamNames.push_back(tmpTeamStr); |
|
130 |
ui.CBTeamName->addItem(tmpTeamStr); |
|
21 | 131 |
} |
25 | 132 |
|
20 | 133 |
QFile settings(cfgdir.absolutePath() + "/options"); |
25 | 134 |
if (settings.open(QIODevice::ReadOnly)) |
20 | 135 |
{ |
25 | 136 |
QTextStream stream(&settings); |
137 |
stream.setCodec("UTF-8"); |
|
138 |
QString str; |
|
139 |
||
140 |
while (!stream.atEnd()) |
|
20 | 141 |
{ |
25 | 142 |
str = stream.readLine(); |
143 |
if (str.startsWith(";")) continue; |
|
144 |
if (str.startsWith("resolution ")) |
|
145 |
{ |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
146 |
ui.CBResolution->setCurrentIndex(str.mid(11).toLong()); |
25 | 147 |
} else |
148 |
if (str.startsWith("fullscreen ")) |
|
149 |
{ |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
150 |
ui.CBFullscreen->setChecked(str.mid(11).toLong()); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
151 |
} else |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
152 |
if (str.startsWith("nick ")) |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
153 |
{ |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
154 |
ui.editNetNick->setText(str.mid(5)); |
25 | 155 |
} |
20 | 156 |
} |
25 | 157 |
settings.close(); |
20 | 158 |
} |
26 | 159 |
|
28 | 160 |
connect(ui.BtnSPBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
161 |
connect(ui.BtnDemosBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
|
162 |
connect(ui.BtnSetupBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
|
163 |
connect(ui.BtnMPBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
|
164 |
connect(ui.BtnNetBack, SIGNAL(clicked()), this, SLOT(GoToMain())); |
|
165 |
connect(ui.BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer())); |
|
166 |
connect(ui.BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup())); |
|
167 |
connect(ui.BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer())); |
|
168 |
connect(ui.BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos())); |
|
169 |
connect(ui.BtnNet, SIGNAL(clicked()), this, SLOT(GoToNet())); |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
170 |
connect(ui.BtnNetCFGBack, SIGNAL(clicked()), this, SLOT(GoToNetChat())); |
28 | 171 |
connect(ui.BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam())); |
172 |
connect(ui.BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam())); |
|
173 |
connect(ui.BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave())); |
|
174 |
connect(ui.BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard())); |
|
175 |
connect(ui.BtnSimpleGame, SIGNAL(clicked()), this, SLOT(SimpleGame())); |
|
176 |
connect(ui.BtnSaveOptions, SIGNAL(clicked()), this, SLOT(SaveOptions())); |
|
177 |
connect(ui.BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo())); |
|
178 |
connect(ui.BtnNetConnect, SIGNAL(clicked()), this, SLOT(NetConnect())); |
|
179 |
connect(ui.BtnNetChatDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect())); |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
180 |
connect(ui.BtnNetChatJoin, SIGNAL(clicked()), this, SLOT(NetJoin())); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
181 |
connect(ui.BtnNetChatCreate, SIGNAL(clicked()), this, SLOT(NetCreate())); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
182 |
connect(ui.BtnNetCFGAddTeam, SIGNAL(clicked()), this, SLOT(NetAddTeam())); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
183 |
connect(ui.BtnNetCFGGo, SIGNAL(clicked()), this, SLOT(NetStartGame())); |
28 | 184 |
connect(ui.CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &))); |
185 |
connect(ui.CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
|
20 | 186 |
ui.Pages->setCurrentIndex(ID_PAGE_MAIN); |
187 |
} |
|
188 |
||
189 |
void HWForm::GoToMain() |
|
190 |
{ |
|
191 |
ui.Pages->setCurrentIndex(ID_PAGE_MAIN); |
|
192 |
} |
|
193 |
||
194 |
void HWForm::GoToSinglePlayer() |
|
195 |
{ |
|
196 |
ui.Pages->setCurrentIndex(ID_PAGE_SINGLEPLAYER); |
|
50 | 197 |
|
198 |
TeamSelWidget* pts=new TeamSelWidget(m_teamNames, ui.Pages->widget(ID_PAGE_SINGLEPLAYER)); |
|
199 |
||
200 |
pts->resize(500, 350); |
|
201 |
pts->show(); |
|
20 | 202 |
} |
203 |
||
204 |
void HWForm::GoToSetup() |
|
205 |
{ |
|
206 |
ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
|
207 |
} |
|
208 |
||
25 | 209 |
void HWForm::GoToMultiplayer() |
210 |
{ |
|
211 |
ui.Pages->setCurrentIndex(ID_PAGE_MULTIPLAYER); |
|
212 |
} |
|
26 | 213 |
|
214 |
void HWForm::GoToDemos() |
|
215 |
{ |
|
216 |
QDir tmpdir; |
|
217 |
tmpdir.cd(DATA_PATH); |
|
218 |
tmpdir.cd("Demos"); |
|
219 |
tmpdir.setFilter(QDir::Files); |
|
28 | 220 |
ui.DemosList->clear(); |
26 | 221 |
ui.DemosList->addItems(tmpdir.entryList(QStringList("*.hwd_1")).replaceInStrings(QRegExp("^(.*).hwd_1"), "\\1")); |
222 |
ui.Pages->setCurrentIndex(ID_PAGE_DEMOS); |
|
223 |
} |
|
224 |
||
28 | 225 |
void HWForm::GoToNet() |
226 |
{ |
|
227 |
ui.Pages->setCurrentIndex(ID_PAGE_NET); |
|
228 |
} |
|
229 |
||
230 |
void HWForm::GoToNetChat() |
|
231 |
{ |
|
232 |
ui.Pages->setCurrentIndex(ID_PAGE_NETCHAT); |
|
233 |
} |
|
234 |
||
20 | 235 |
void HWForm::NewTeam() |
236 |
{ |
|
25 | 237 |
tmpTeam = new HWTeam("unnamed"); |
21 | 238 |
tmpTeam->SetCfgDir(cfgdir.absolutePath()); |
239 |
tmpTeam->SetToPage(this); |
|
20 | 240 |
ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM); |
241 |
} |
|
242 |
||
243 |
void HWForm::EditTeam() |
|
244 |
{ |
|
25 | 245 |
tmpTeam = new HWTeam(ui.CBTeamName->currentText()); |
21 | 246 |
tmpTeam->SetCfgDir(cfgdir.absolutePath()); |
247 |
tmpTeam->LoadFromFile(); |
|
248 |
tmpTeam->SetToPage(this); |
|
20 | 249 |
ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM); |
250 |
} |
|
251 |
||
252 |
void HWForm::TeamSave() |
|
253 |
{ |
|
21 | 254 |
tmpTeam->GetFromPage(this); |
255 |
tmpTeam->SaveToFile(); |
|
256 |
delete tmpTeam; |
|
20 | 257 |
ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
258 |
} |
|
259 |
||
260 |
void HWForm::TeamDiscard() |
|
261 |
{ |
|
262 |
ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
|
263 |
} |
|
264 |
||
265 |
void HWForm::SimpleGame() |
|
266 |
{ |
|
26 | 267 |
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
|
268 |
game->AddTeam("DefaultTeam"); |
1072e7fe85c8
DefaultTeam is now default to play with single and network game
displacer
parents:
44
diff
changeset
|
269 |
game->AddTeam("DefaultTeam"); |
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
270 |
game->StartLocal(); |
20 | 271 |
} |
272 |
||
273 |
void HWForm::CBGrave_activated(const QString & gravename) |
|
274 |
{ |
|
275 |
QPixmap pix(QString(DATA_PATH) + "/Graphics/Graves/" + gravename + ".png"); |
|
276 |
ui.GravePreview->setPixmap(pix.copy(0, 0, 32, 32)); |
|
277 |
} |
|
278 |
||
279 |
void HWForm::CBFort_activated(const QString & fortname) |
|
280 |
{ |
|
281 |
QPixmap pix(QString(DATA_PATH) + "/Forts/" + fortname + "L.png"); |
|
282 |
ui.FortPreview->setPixmap(pix); |
|
283 |
} |
|
284 |
||
285 |
void HWForm::SaveOptions() |
|
286 |
{ |
|
287 |
QFile settings(cfgdir.absolutePath() + "/options"); |
|
288 |
if (!settings.open(QIODevice::WriteOnly)) |
|
289 |
{ |
|
25 | 290 |
QMessageBox::critical(this, |
20 | 291 |
tr("Error"), |
43 | 292 |
tr("Cannot save options to file %1").arg(settings.fileName()), |
20 | 293 |
tr("Quit")); |
294 |
return ; |
|
295 |
} |
|
296 |
QTextStream stream(&settings); |
|
297 |
stream.setCodec("UTF-8"); |
|
298 |
stream << "; Generated by Hedgewars, do not modify" << endl; |
|
299 |
stream << "resolution " << ui.CBResolution->currentIndex() << endl; |
|
300 |
stream << "fullscreen " << ui.CBFullscreen->isChecked() << endl; |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
301 |
stream << "nick " << ui.editNetNick->text() << endl; |
20 | 302 |
settings.close(); |
303 |
} |
|
26 | 304 |
|
305 |
void HWForm::PlayDemo() |
|
306 |
{ |
|
307 |
QListWidgetItem * curritem = ui.DemosList->currentItem(); |
|
308 |
if (!curritem) |
|
309 |
{ |
|
310 |
QMessageBox::critical(this, |
|
311 |
tr("Error"), |
|
312 |
tr("Please, select demo from the list above"), |
|
313 |
tr("OK")); |
|
314 |
return ; |
|
315 |
} |
|
316 |
game = new HWGame(ui.CBResolution->currentIndex(), ui.CBFullscreen->isChecked()); |
|
317 |
game->PlayDemo(QString(DATA_PATH) + "/Demos/" + curritem->text() + ".hwd_1"); |
|
318 |
} |
|
319 |
||
28 | 320 |
void HWForm::NetConnect() |
321 |
{ |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
322 |
hwnet = new HWNet(ui.CBResolution->currentIndex(), ui.CBFullscreen->isChecked()); |
28 | 323 |
connect(hwnet, SIGNAL(Connected()), this, SLOT(GoToNetChat())); |
324 |
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
|
325 |
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
|
326 |
connect(hwnet, SIGNAL(ChangeInTeams(const QStringList &)), this, SLOT(ChangeInNetTeams(const QStringList &))); |
36 | 327 |
hwnet->Connect("172.19.5.168", 6667, ui.editNetNick->text()); |
28 | 328 |
} |
26 | 329 |
|
28 | 330 |
void HWForm::NetDisconnect() |
331 |
{ |
|
332 |
hwnet->Disconnect(); |
|
333 |
GoToNet(); |
|
334 |
} |
|
335 |
||
336 |
void HWForm::AddGame(const QString & chan) |
|
337 |
{ |
|
338 |
ui.ChannelsList->addItem(chan); |
|
339 |
} |
|
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
340 |
|
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
341 |
void HWForm::NetGameEnter() |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
342 |
{ |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
343 |
ui.Pages->setCurrentIndex(ID_PAGE_NETCFG); |
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 |
|
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
346 |
void HWForm::NetJoin() |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
347 |
{ |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
348 |
hwnet->JoinGame("#hw"); |
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 |
|
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
351 |
void HWForm::NetCreate() |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
352 |
{ |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
353 |
hwnet->JoinGame("#hw"); |
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 |
|
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
356 |
void HWForm::NetAddTeam() |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
357 |
{ |
45
1072e7fe85c8
DefaultTeam is now default to play with single and network game
displacer
parents:
44
diff
changeset
|
358 |
HWTeam team("DefaultTeam"); |
31
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
359 |
team.SetCfgDir(cfgdir.absolutePath()); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
360 |
team.LoadFromFile(); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
361 |
hwnet->AddTeam(team); |
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 |
|
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
364 |
void HWForm::NetStartGame() |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
365 |
{ |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
366 |
hwnet->StartGame(); |
99888245a4e8
Now net game is near available, but exception occurs...
unc0rr
parents:
28
diff
changeset
|
367 |
} |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
368 |
|
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
369 |
void HWForm::ChangeInNetTeams(const QStringList & teams) |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
370 |
{ |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
371 |
ui.listNetTeams->clear(); |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
372 |
ui.listNetTeams->addItems(teams); |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
373 |
} |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
31
diff
changeset
|
374 |