author | smxx |
Sat, 10 Apr 2010 21:36:40 +0000 | |
changeset 3333 | 560e2766c445 |
parent 3236 | 4ab3917d7d44 |
child 3344 | b18a166e6ca4 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
3236
4ab3917d7d44
Update (c) lines to 2010 as unc0rr requested - they all had varying values so I just took the first year mentioned, then tacked on -2010
nemo
parents:
3159
diff
changeset
|
3 |
* Copyright (c) 2005-2010 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#include <QFile> |
|
20 |
#include <QTextStream> |
|
21 |
#include <QApplication> |
|
471 | 22 |
#include <QStringList> |
23 |
#include <QLineEdit> |
|
2874
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
24 |
#include <QCryptographicHash> |
3333 | 25 |
#include <QSettings> |
184 | 26 |
#include "team.h" |
27 |
#include "hwform.h" |
|
28 |
#include "pages.h" |
|
29 |
#include "hwconsts.h" |
|
1240 | 30 |
#include "hats.h" |
314 | 31 |
|
1325 | 32 |
HWTeam::HWTeam(const QString & teamname) : |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
33 |
difficulty(0), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
34 |
numHedgehogs(4), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
35 |
m_isNetTeam(false) |
184 | 36 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
37 |
TeamName = teamname; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
38 |
OldTeamName = TeamName; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
39 |
for (int i = 0; i < 8; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
40 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
41 |
HHName[i].sprintf("hedgehog %d", i); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
42 |
HHHat[i] = "NoHat"; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
43 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
44 |
Grave = "Statue"; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
45 |
Fort = "Plane"; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
46 |
Voicepack = "Default"; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
47 |
Flag = "hedgewars"; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
48 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
49 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
50 |
binds[i].action = cbinds[i].action; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
51 |
binds[i].strbind = cbinds[i].strbind; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
52 |
} |
184 | 53 |
} |
54 |
||
353 | 55 |
HWTeam::HWTeam(const QStringList& strLst) : |
1325 | 56 |
numHedgehogs(4), |
57 |
m_isNetTeam(true) |
|
314 | 58 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
59 |
// net teams are configured from QStringList |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
60 |
if(strLst.size() != 23) throw HWTeamConstructException(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
61 |
TeamName = strLst[0]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
62 |
Grave = strLst[1]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
63 |
Fort = strLst[2]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
64 |
Voicepack = strLst[3]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
65 |
Flag = strLst[4]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
66 |
Owner = strLst[5]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
67 |
difficulty = strLst[6].toUInt(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
68 |
for(int i = 0; i < 8; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
69 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
70 |
HHName[i]=strLst[i * 2 + 7]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
71 |
HHHat[i]=strLst[i * 2 + 8]; |
2833
9c2accd92cc7
Check for empty hat, somehow claymore managed this, this should be a workaround pending figuring out how he did it.
nemo
parents:
2747
diff
changeset
|
72 |
// Somehow claymore managed an empty hat. Until we figure out how, this should avoid a repeat |
9c2accd92cc7
Check for empty hat, somehow claymore managed this, this should be a workaround pending figuring out how he did it.
nemo
parents:
2747
diff
changeset
|
73 |
// Checking net teams is probably pointless, but can't hurt. |
9c2accd92cc7
Check for empty hat, somehow claymore managed this, this should be a workaround pending figuring out how he did it.
nemo
parents:
2747
diff
changeset
|
74 |
if (HHHat[i].length() == 0) HHHat[i] = "NoHat"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
75 |
} |
314 | 76 |
} |
77 |
||
1907 | 78 |
HWTeam::HWTeam() : |
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
336
diff
changeset
|
79 |
difficulty(0), |
353 | 80 |
numHedgehogs(4), |
1325 | 81 |
m_isNetTeam(false) |
184 | 82 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
83 |
TeamName = QString("Team"); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
84 |
for (int i = 0; i < 8; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
85 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
86 |
HHName[i].sprintf("hedgehog %d", i); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
87 |
HHHat[i] = "NoHat"; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
88 |
} |
1840 | 89 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
90 |
Grave = QString("Simple"); // default |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
91 |
Fort = QString("Island"); // default |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
92 |
Voicepack = "Default"; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
93 |
Flag = "hedgewars"; |
1907 | 94 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
95 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
96 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
97 |
binds[i].action = cbinds[i].action; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
98 |
binds[i].strbind = cbinds[i].strbind; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
99 |
} |
184 | 100 |
} |
101 |
||
102 |
||
103 |
bool HWTeam::LoadFromFile() |
|
104 |
{ |
|
3333 | 105 |
QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + TeamName + ".ini", QSettings::IniFormat, 0); |
106 |
teamfile.setIniCodec("UTF-8"); |
|
107 |
TeamName = teamfile.value("Team/Name", TeamName).toString(); |
|
108 |
Grave = teamfile.value("Team/Grave", "Statue").toString(); |
|
109 |
Fort = teamfile.value("Team/Fort", "Plane").toString(); |
|
110 |
Voicepack = teamfile.value("Team/Voicepack", "Default").toString(); |
|
111 |
Flag = teamfile.value("Team/Flag", "hedgewars").toString(); |
|
112 |
difficulty = teamfile.value("Team/Difficulty", 0).toInt(); |
|
113 |
for(int i = 0; i < 8; i++) |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
114 |
{ |
3333 | 115 |
QString hh = QString("Hedgehog%1/").arg(i); |
116 |
HHName[i] = teamfile.value(hh + "Name", QString("hedgehog %1").arg(i)).toString(); |
|
117 |
HHHat[i] = teamfile.value(hh + "Hat", "NoHat").toString(); |
|
118 |
//teamfile.setValue(hh + "Kills", 0); |
|
119 |
//teamfile.setValue(hh + "Deaths", 0); |
|
120 |
//teamfile.setValue(hh + "Rounds", 0); |
|
121 |
//teamfile.setValue(hh + "Suicides", 0); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
122 |
} |
3333 | 123 |
for(int i = 0; i < BINDS_NUMBER; i++) |
124 |
binds[i].action = teamfile.value(QString("Binds/%1").arg(binds[i].strbind), cbinds[i].action).toString(); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
125 |
return true; |
184 | 126 |
} |
127 |
||
3159 | 128 |
bool HWTeam::DeleteFile() |
129 |
{ |
|
130 |
if(m_isNetTeam) |
|
131 |
return false; |
|
3333 | 132 |
QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + TeamName + ".ini"); |
3159 | 133 |
cfgfile.remove(); |
134 |
return true; |
|
135 |
} |
|
136 |
||
184 | 137 |
bool HWTeam::SaveToFile() |
138 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
139 |
if (OldTeamName != TeamName) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
140 |
{ |
3333 | 141 |
QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + OldTeamName + ".ini"); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
142 |
cfgfile.remove(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
143 |
OldTeamName = TeamName; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
144 |
} |
3333 | 145 |
QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + TeamName + ".ini", QSettings::IniFormat, 0); |
146 |
teamfile.setIniCodec("UTF-8"); |
|
147 |
teamfile.setValue("Team/Name", TeamName); |
|
148 |
teamfile.setValue("Team/Grave", Grave); |
|
149 |
teamfile.setValue("Team/Fort", Fort); |
|
150 |
teamfile.setValue("Team/Voicepack", Voicepack); |
|
151 |
teamfile.setValue("Team/Flag", Flag); |
|
152 |
teamfile.setValue("Team/Difficulty", difficulty); |
|
153 |
for(int i = 0; i < 8; i++) |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
154 |
{ |
3333 | 155 |
QString hh = QString("Hedgehog%1/").arg(i); |
156 |
teamfile.setValue(hh + "Name", HHName[i]); |
|
157 |
teamfile.setValue(hh + "Hat", HHHat[i]); |
|
158 |
teamfile.setValue(hh + "Kills", 0); |
|
159 |
teamfile.setValue(hh + "Deaths", 0); |
|
160 |
teamfile.setValue(hh + "Rounds", 0); |
|
161 |
teamfile.setValue(hh + "Suicides", 0); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
162 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
163 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3333 | 164 |
teamfile.setValue(QString("Binds/%1").arg(binds[i].strbind), binds[i].action); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
165 |
return true; |
184 | 166 |
} |
167 |
||
168 |
void HWTeam::SetToPage(HWForm * hwform) |
|
169 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
170 |
hwform->ui.pageEditTeam->TeamNameEdit->setText(TeamName); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
171 |
hwform->ui.pageEditTeam->CBTeamLvl->setCurrentIndex(difficulty); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
172 |
for(int i = 0; i < 8; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
173 |
{ |
2874
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
174 |
hwform->ui.pageEditTeam->HHNameEdit[i]->setText(HHName[i]); |
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
175 |
if (HHHat[i].startsWith("Reserved")) |
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
176 |
hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData("Reserved "+HHHat[i].remove(0,40), Qt::DisplayRole)); |
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
177 |
else |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
178 |
hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData(HHHat[i], Qt::DisplayRole)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
179 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
180 |
hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(Grave)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
181 |
hwform->ui.pageEditTeam->CBFlag->setCurrentIndex(hwform->ui.pageEditTeam->CBFlag->findText(Flag)); |
184 | 182 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
183 |
hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(Fort)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
184 |
hwform->ui.pageEditTeam->CBVoicepack->setCurrentIndex(hwform->ui.pageEditTeam->CBVoicepack->findText(Voicepack)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
185 |
//hwform->ui.pageEditTeam->CBFort_activated(Fort); |
184 | 186 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
187 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
188 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
189 |
hwform->ui.pageEditTeam->CBBind[i]->setCurrentIndex(hwform->ui.pageEditTeam->CBBind[i]->findData(binds[i].strbind)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
190 |
} |
184 | 191 |
} |
192 |
||
193 |
void HWTeam::GetFromPage(HWForm * hwform) |
|
194 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
195 |
TeamName = hwform->ui.pageEditTeam->TeamNameEdit->text(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
196 |
difficulty = hwform->ui.pageEditTeam->CBTeamLvl->currentIndex(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
197 |
for(int i = 0; i < 8; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
198 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
199 |
HHName[i] = hwform->ui.pageEditTeam->HHNameEdit[i]->text(); |
2874
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
200 |
if (hwform->ui.pageEditTeam->HHHats[i]->currentText().startsWith("Reserved")) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
201 |
HHHat[i] = "Reserved"+playerHash+hwform->ui.pageEditTeam->HHHats[i]->currentText().remove(0,9); |
2874
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
202 |
else |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
203 |
HHHat[i] = hwform->ui.pageEditTeam->HHHats[i]->currentText(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
204 |
} |
184 | 205 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
206 |
Grave = hwform->ui.pageEditTeam->CBGrave->currentText(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
207 |
Fort = hwform->ui.pageEditTeam->CBFort->currentText(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
208 |
Voicepack = hwform->ui.pageEditTeam->CBVoicepack->currentText(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
209 |
Flag = hwform->ui.pageEditTeam->CBFlag->currentText(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
210 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
211 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
212 |
binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->itemData(hwform->ui.pageEditTeam->CBBind[i]->currentIndex()).toString(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
213 |
} |
184 | 214 |
} |
215 |
||
341 | 216 |
QStringList HWTeam::TeamGameConfig(quint32 InitHealth) const |
184 | 217 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
218 |
QStringList sl; |
2874
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
219 |
if (m_isNetTeam) |
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
220 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
221 |
sl.push_back(QString("eaddteam %3 %1 %2").arg(teamColor.rgb() & 0xffffff).arg(TeamName).arg(QString(QCryptographicHash::hash(Owner.toLatin1(), QCryptographicHash::Md5).toHex()))); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
222 |
sl.push_back("erdriven"); |
2874
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
223 |
} |
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2833
diff
changeset
|
224 |
else sl.push_back(QString("eaddteam %3 %1 %2").arg(teamColor.rgb() & 0xffffff).arg(TeamName).arg(playerHash)); |
606
9d800fdfd3bd
Add ammostores in frontend, should help further ammostores implemetation
unc0rr
parents:
605
diff
changeset
|
225 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
226 |
sl.push_back(QString("egrave " + Grave)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
227 |
sl.push_back(QString("efort " + Fort)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
228 |
sl.push_back(QString("evoicepack " + Voicepack)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
229 |
sl.push_back(QString("eflag " + Flag)); |
341 | 230 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
231 |
if (!m_isNetTeam) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
232 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
233 |
if(!binds[i].strbind.isEmpty()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
234 |
sl.push_back(QString("ebind " + binds[i].strbind + " " + binds[i].action)); |
341 | 235 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
236 |
for (int t = 0; t < numHedgehogs; t++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
237 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
238 |
sl.push_back(QString("eaddhh %1 %2 %3") |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
239 |
.arg(QString::number(difficulty), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
240 |
QString::number(InitHealth), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
241 |
HHName[t])); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
242 |
sl.push_back(QString("ehat %1") |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
243 |
.arg(HHHat[t])); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
244 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
245 |
return sl; |
184 | 246 |
} |
247 |
||
352 | 248 |
bool HWTeam::isNetTeam() const |
249 |
{ |
|
1325 | 250 |
return m_isNetTeam; |
352 | 251 |
} |
252 |
||
253 |
||
184 | 254 |
bool HWTeam::operator==(const HWTeam& t1) const { |
1325 | 255 |
return TeamName==t1.TeamName; |
184 | 256 |
} |
257 |
||
258 |
bool HWTeam::operator<(const HWTeam& t1) const { |
|
1325 | 259 |
return TeamName<t1.TeamName; // if names are equal - test if it is net team |
184 | 260 |
} |
1840 | 261 |
|
262 |