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