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