author | koda |
Thu, 26 Aug 2010 23:59:18 +0200 | |
branch | experimental3D |
changeset 3698 | 793386610068 |
parent 3381 | f8800c44b3de |
child 3697 | d5b30d6373fc |
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 |
{ |
3344 | 41 |
Hedgehogs[i].Name.sprintf("hedgehog %d", i); |
42 |
Hedgehogs[i].Hat = "NoHat"; |
|
2948
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 |
} |
3381 | 53 |
Rounds = 0; |
54 |
Wins = 0; |
|
184 | 55 |
} |
56 |
||
353 | 57 |
HWTeam::HWTeam(const QStringList& strLst) : |
1325 | 58 |
numHedgehogs(4), |
59 |
m_isNetTeam(true) |
|
314 | 60 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
61 |
// net teams are configured from QStringList |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
62 |
if(strLst.size() != 23) throw HWTeamConstructException(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
63 |
TeamName = strLst[0]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
64 |
Grave = strLst[1]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
65 |
Fort = strLst[2]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
66 |
Voicepack = strLst[3]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
67 |
Flag = strLst[4]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
68 |
Owner = strLst[5]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
69 |
difficulty = strLst[6].toUInt(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
70 |
for(int i = 0; i < 8; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
71 |
{ |
3344 | 72 |
Hedgehogs[i].Name=strLst[i * 2 + 7]; |
73 |
Hedgehogs[i].Hat=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
|
74 |
// 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
|
75 |
// Checking net teams is probably pointless, but can't hurt. |
3344 | 76 |
if (Hedgehogs[i].Hat.length() == 0) Hedgehogs[i].Hat = "NoHat"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
77 |
} |
3381 | 78 |
Rounds = 0; |
79 |
Wins = 0; |
|
314 | 80 |
} |
81 |
||
1907 | 82 |
HWTeam::HWTeam() : |
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
336
diff
changeset
|
83 |
difficulty(0), |
353 | 84 |
numHedgehogs(4), |
1325 | 85 |
m_isNetTeam(false) |
184 | 86 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
87 |
TeamName = QString("Team"); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
88 |
for (int i = 0; i < 8; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
89 |
{ |
3344 | 90 |
Hedgehogs[i].Name.sprintf("hedgehog %d", i); |
91 |
Hedgehogs[i].Hat = "NoHat"; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
92 |
} |
1840 | 93 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
94 |
Grave = QString("Simple"); // default |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
95 |
Fort = QString("Island"); // default |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
96 |
Voicepack = "Default"; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
97 |
Flag = "hedgewars"; |
1907 | 98 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
99 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
100 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
101 |
binds[i].action = cbinds[i].action; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
102 |
binds[i].strbind = cbinds[i].strbind; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
103 |
} |
3381 | 104 |
Rounds = 0; |
105 |
Wins = 0; |
|
184 | 106 |
} |
107 |
||
108 |
||
109 |
bool HWTeam::LoadFromFile() |
|
110 |
{ |
|
3333 | 111 |
QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + TeamName + ".ini", QSettings::IniFormat, 0); |
112 |
teamfile.setIniCodec("UTF-8"); |
|
113 |
TeamName = teamfile.value("Team/Name", TeamName).toString(); |
|
114 |
Grave = teamfile.value("Team/Grave", "Statue").toString(); |
|
115 |
Fort = teamfile.value("Team/Fort", "Plane").toString(); |
|
116 |
Voicepack = teamfile.value("Team/Voicepack", "Default").toString(); |
|
117 |
Flag = teamfile.value("Team/Flag", "hedgewars").toString(); |
|
118 |
difficulty = teamfile.value("Team/Difficulty", 0).toInt(); |
|
3381 | 119 |
Rounds = teamfile.value("Team/Rounds", 0).toInt(); |
120 |
Wins = teamfile.value("Team/Wins", 0).toInt(); |
|
3333 | 121 |
for(int i = 0; i < 8; i++) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
122 |
{ |
3333 | 123 |
QString hh = QString("Hedgehog%1/").arg(i); |
3344 | 124 |
Hedgehogs[i].Name = teamfile.value(hh + "Name", QString("hedgehog %1").arg(i)).toString(); |
125 |
Hedgehogs[i].Hat = teamfile.value(hh + "Hat", "NoHat").toString(); |
|
126 |
Hedgehogs[i].Rounds = teamfile.value(hh + "Rounds", 0).toInt(); |
|
127 |
Hedgehogs[i].Kills = teamfile.value(hh + "Kills", 0).toInt(); |
|
128 |
Hedgehogs[i].Deaths = teamfile.value(hh + "Deaths", 0).toInt(); |
|
129 |
Hedgehogs[i].Suicides = teamfile.value(hh + "Suicides", 0).toInt(); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
130 |
} |
3333 | 131 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3359 | 132 |
binds[i].strbind = teamfile.value(QString("Binds/%1").arg(binds[i].action), cbinds[i].strbind).toString(); |
3344 | 133 |
for(int i = 0; i < MAX_ACHIEVEMENTS; i++) |
134 |
if(achievements[i][0][0]) |
|
135 |
AchievementProgress[i] = teamfile.value(QString("Achievements/%1").arg(achievements[i][0]), 0).toUInt(); |
|
136 |
else |
|
137 |
break; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
138 |
return true; |
184 | 139 |
} |
140 |
||
3381 | 141 |
bool HWTeam::FileExists() |
142 |
{ |
|
143 |
QFile f(cfgdir->absolutePath() + "/Teams/" + TeamName + ".ini"); |
|
144 |
return f.exists(); |
|
145 |
} |
|
146 |
||
3159 | 147 |
bool HWTeam::DeleteFile() |
148 |
{ |
|
149 |
if(m_isNetTeam) |
|
150 |
return false; |
|
3333 | 151 |
QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + TeamName + ".ini"); |
3159 | 152 |
cfgfile.remove(); |
153 |
return true; |
|
154 |
} |
|
155 |
||
184 | 156 |
bool HWTeam::SaveToFile() |
157 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
158 |
if (OldTeamName != TeamName) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
159 |
{ |
3333 | 160 |
QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + OldTeamName + ".ini"); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
161 |
cfgfile.remove(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
162 |
OldTeamName = TeamName; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
163 |
} |
3333 | 164 |
QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + TeamName + ".ini", QSettings::IniFormat, 0); |
165 |
teamfile.setIniCodec("UTF-8"); |
|
166 |
teamfile.setValue("Team/Name", TeamName); |
|
167 |
teamfile.setValue("Team/Grave", Grave); |
|
168 |
teamfile.setValue("Team/Fort", Fort); |
|
169 |
teamfile.setValue("Team/Voicepack", Voicepack); |
|
170 |
teamfile.setValue("Team/Flag", Flag); |
|
171 |
teamfile.setValue("Team/Difficulty", difficulty); |
|
3381 | 172 |
teamfile.setValue("Team/Rounds", Rounds); |
173 |
teamfile.setValue("Team/Wins", Wins); |
|
3333 | 174 |
for(int i = 0; i < 8; i++) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
175 |
{ |
3333 | 176 |
QString hh = QString("Hedgehog%1/").arg(i); |
3344 | 177 |
teamfile.setValue(hh + "Name", Hedgehogs[i].Name); |
178 |
teamfile.setValue(hh + "Hat", Hedgehogs[i].Hat); |
|
179 |
teamfile.setValue(hh + "Rounds", Hedgehogs[i].Rounds); |
|
180 |
teamfile.setValue(hh + "Kills", Hedgehogs[i].Kills); |
|
181 |
teamfile.setValue(hh + "Deaths", Hedgehogs[i].Deaths); |
|
182 |
teamfile.setValue(hh + "Suicides", Hedgehogs[i].Suicides); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
183 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
184 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3359 | 185 |
teamfile.setValue(QString("Binds/%1").arg(binds[i].action), binds[i].strbind); |
3344 | 186 |
for(int i = 0; i < MAX_ACHIEVEMENTS; i++) |
187 |
if(achievements[i][0][0]) |
|
188 |
teamfile.setValue(QString("Achievements/%1").arg(achievements[i][0]), AchievementProgress[i]); |
|
189 |
else |
|
190 |
break; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
191 |
return true; |
184 | 192 |
} |
193 |
||
194 |
void HWTeam::SetToPage(HWForm * hwform) |
|
195 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
196 |
hwform->ui.pageEditTeam->TeamNameEdit->setText(TeamName); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
197 |
hwform->ui.pageEditTeam->CBTeamLvl->setCurrentIndex(difficulty); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
198 |
for(int i = 0; i < 8; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
199 |
{ |
3344 | 200 |
hwform->ui.pageEditTeam->HHNameEdit[i]->setText(Hedgehogs[i].Name); |
201 |
if (Hedgehogs[i].Hat.startsWith("Reserved")) |
|
202 |
hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData("Reserved "+Hedgehogs[i].Hat.remove(0,40), Qt::DisplayRole)); |
|
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
|
203 |
else |
3344 | 204 |
hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData(Hedgehogs[i].Hat, Qt::DisplayRole)); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
205 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
206 |
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
|
207 |
hwform->ui.pageEditTeam->CBFlag->setCurrentIndex(hwform->ui.pageEditTeam->CBFlag->findText(Flag)); |
184 | 208 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
209 |
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
|
210 |
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
|
211 |
//hwform->ui.pageEditTeam->CBFort_activated(Fort); |
184 | 212 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
213 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
214 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
215 |
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
|
216 |
} |
184 | 217 |
} |
218 |
||
219 |
void HWTeam::GetFromPage(HWForm * hwform) |
|
220 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
221 |
TeamName = hwform->ui.pageEditTeam->TeamNameEdit->text(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
222 |
difficulty = hwform->ui.pageEditTeam->CBTeamLvl->currentIndex(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
223 |
for(int i = 0; i < 8; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
224 |
{ |
3344 | 225 |
Hedgehogs[i].Name = 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
|
226 |
if (hwform->ui.pageEditTeam->HHHats[i]->currentText().startsWith("Reserved")) |
3344 | 227 |
Hedgehogs[i].Hat = "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
|
228 |
else |
3344 | 229 |
Hedgehogs[i].Hat = hwform->ui.pageEditTeam->HHHats[i]->currentText(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
230 |
} |
184 | 231 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
232 |
Grave = hwform->ui.pageEditTeam->CBGrave->currentText(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
233 |
Fort = hwform->ui.pageEditTeam->CBFort->currentText(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
234 |
Voicepack = hwform->ui.pageEditTeam->CBVoicepack->currentText(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
235 |
Flag = hwform->ui.pageEditTeam->CBFlag->currentText(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
236 |
for(int i = 0; i < BINDS_NUMBER; i++) |
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 |
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
|
239 |
} |
184 | 240 |
} |
241 |
||
341 | 242 |
QStringList HWTeam::TeamGameConfig(quint32 InitHealth) const |
184 | 243 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
244 |
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
|
245 |
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
|
246 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
247 |
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
|
248 |
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
|
249 |
} |
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
|
250 |
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
|
251 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
252 |
sl.push_back(QString("egrave " + Grave)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
253 |
sl.push_back(QString("efort " + Fort)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
254 |
sl.push_back(QString("evoicepack " + Voicepack)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
255 |
sl.push_back(QString("eflag " + Flag)); |
341 | 256 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
257 |
if (!m_isNetTeam) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
258 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
259 |
if(!binds[i].strbind.isEmpty()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
260 |
sl.push_back(QString("ebind " + binds[i].strbind + " " + binds[i].action)); |
341 | 261 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
262 |
for (int t = 0; t < numHedgehogs; t++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
263 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
264 |
sl.push_back(QString("eaddhh %1 %2 %3") |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
265 |
.arg(QString::number(difficulty), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
266 |
QString::number(InitHealth), |
3344 | 267 |
Hedgehogs[t].Name)); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
268 |
sl.push_back(QString("ehat %1") |
3344 | 269 |
.arg(Hedgehogs[t].Hat)); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
270 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
271 |
return sl; |
184 | 272 |
} |
273 |
||
352 | 274 |
bool HWTeam::isNetTeam() const |
275 |
{ |
|
1325 | 276 |
return m_isNetTeam; |
352 | 277 |
} |
278 |
||
279 |
||
184 | 280 |
bool HWTeam::operator==(const HWTeam& t1) const { |
1325 | 281 |
return TeamName==t1.TeamName; |
184 | 282 |
} |
283 |
||
284 |
bool HWTeam::operator<(const HWTeam& t1) const { |
|
1325 | 285 |
return TeamName<t1.TeamName; // if names are equal - test if it is net team |
184 | 286 |
} |
1840 | 287 |
|
288 |