author | unc0rr |
Fri, 02 Dec 2011 15:03:27 +0400 | |
changeset 6498 | 5678806aafca |
parent 6225 | 505643d4c23d |
child 6616 | f77bb02b669f |
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> |
|
471 | 21 |
#include <QStringList> |
22 |
#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
|
23 |
#include <QCryptographicHash> |
3333 | 24 |
#include <QSettings> |
5252 | 25 |
|
184 | 26 |
#include "team.h" |
27 |
#include "hwform.h" |
|
1240 | 28 |
#include "hats.h" |
314 | 29 |
|
1325 | 30 |
HWTeam::HWTeam(const QString & teamname) : |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
31 |
QObject(0) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
32 |
, m_difficulty(0) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
33 |
, m_numHedgehogs(4) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
34 |
, m_isNetTeam(false) |
184 | 35 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
36 |
m_name = teamname; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
37 |
OldTeamName = m_name; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
38 |
for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
39 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
40 |
m_hedgehogs[i].Name = (QLineEdit::tr("hedgehog %1").arg(i+1)); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
41 |
m_hedgehogs[i].Hat = "NoHat"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
42 |
} |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
43 |
m_grave = "Statue"; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
44 |
m_fort = "Plane"; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
45 |
m_voicepack = "Default"; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
46 |
m_flag = "hedgewars"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
47 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
48 |
{ |
6024 | 49 |
m_binds[i].action = cbinds[i].action; |
50 |
m_binds[i].strbind = cbinds[i].strbind; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
51 |
} |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
52 |
m_rounds = 0; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
53 |
m_wins = 0; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
54 |
m_campaignProgress = 0; |
184 | 55 |
} |
56 |
||
353 | 57 |
HWTeam::HWTeam(const QStringList& strLst) : |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
58 |
QObject(0) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
59 |
, m_numHedgehogs(4) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
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(); |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
64 |
m_name = strLst[0]; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
65 |
m_grave = strLst[1]; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
66 |
m_fort = strLst[2]; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
67 |
m_voicepack = strLst[3]; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
68 |
m_flag = strLst[4]; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
69 |
m_owner = strLst[5]; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
70 |
m_difficulty = strLst[6].toUInt(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
71 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
72 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
73 |
m_hedgehogs[i].Name=strLst[i * 2 + 7]; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
74 |
m_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. |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
77 |
if (m_hedgehogs[i].Hat.isEmpty()) m_hedgehogs[i].Hat = "NoHat"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
78 |
} |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
79 |
m_rounds = 0; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
80 |
m_wins = 0; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
81 |
m_campaignProgress = 0; |
314 | 82 |
} |
83 |
||
1907 | 84 |
HWTeam::HWTeam() : |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
85 |
QObject(0) |
6223
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
86 |
, m_difficulty(0) |
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
87 |
, m_numHedgehogs(4) |
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
88 |
, m_isNetTeam(false) |
184 | 89 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
90 |
m_name = QString("Team"); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
91 |
for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
92 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
93 |
m_hedgehogs[i].Name.sprintf("hedgehog %d", i); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
94 |
m_hedgehogs[i].Hat = "NoHat"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
95 |
} |
1840 | 96 |
|
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
97 |
m_grave = QString("Simple"); // default |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
98 |
m_fort = QString("Island"); // default |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
99 |
m_voicepack = "Default"; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
100 |
m_flag = "hedgewars"; |
1907 | 101 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
102 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
103 |
{ |
6024 | 104 |
m_binds[i].action = cbinds[i].action; |
105 |
m_binds[i].strbind = cbinds[i].strbind; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
106 |
} |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
107 |
m_rounds = 0; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
108 |
m_wins = 0; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
109 |
m_campaignProgress = 0; |
184 | 110 |
} |
111 |
||
6223
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
112 |
HWTeam::HWTeam(const HWTeam & other) : |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
113 |
QObject(0) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
114 |
, OldTeamName(other.OldTeamName) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
115 |
, m_name(other.m_name) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
116 |
, m_grave(other.m_grave) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
117 |
, m_fort(other.m_fort) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
118 |
, m_flag(other.m_flag) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
119 |
, m_voicepack(other.m_voicepack) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
120 |
, m_hedgehogs(other.m_hedgehogs) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
121 |
, m_difficulty(other.m_difficulty) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
122 |
, m_binds(other.m_binds) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
123 |
, m_numHedgehogs(other.m_numHedgehogs) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
124 |
, m_color(other.m_color) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
125 |
, m_isNetTeam(other.m_isNetTeam) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
126 |
, m_owner(other.m_owner) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
127 |
, m_campaignProgress(other.m_campaignProgress) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
128 |
, m_rounds(other.m_rounds) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
129 |
, m_wins(other.m_wins) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
130 |
// , AchievementProgress(other.AchievementProgress) |
6223
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
131 |
{ |
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
132 |
|
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
133 |
} |
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
134 |
|
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
135 |
HWTeam & HWTeam::operator = (const HWTeam & other) |
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
136 |
{ |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
137 |
if(this != &other) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
138 |
{ |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
139 |
OldTeamName = other.OldTeamName; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
140 |
m_name = other.m_name; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
141 |
m_grave = other.m_grave; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
142 |
m_fort = other.m_fort; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
143 |
m_flag = other.m_flag; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
144 |
m_voicepack = other.m_voicepack; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
145 |
// m_hedgehogs = other.m_hedgehogs; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
146 |
m_difficulty = other.m_difficulty; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
147 |
// m_binds = other.m_binds; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
148 |
m_numHedgehogs = other.m_numHedgehogs; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
149 |
m_color = other.m_color; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
150 |
m_isNetTeam = other.m_isNetTeam; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
151 |
m_owner = other.m_owner; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
152 |
m_campaignProgress = other.m_campaignProgress; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
153 |
m_rounds = other.m_rounds; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
154 |
m_wins = other.m_wins; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
155 |
} |
6223
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
156 |
|
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
157 |
return *this; |
6223
cc3eb9b7230f
It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents:
6060
diff
changeset
|
158 |
} |
184 | 159 |
|
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
160 |
bool HWTeam::loadFromFile() |
184 | 161 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
162 |
QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt", QSettings::IniFormat, 0); |
3333 | 163 |
teamfile.setIniCodec("UTF-8"); |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
164 |
m_name = teamfile.value("Team/Name", m_name).toString(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
165 |
m_grave = teamfile.value("Team/Grave", "Statue").toString(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
166 |
m_fort = teamfile.value("Team/Fort", "Plane").toString(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
167 |
m_voicepack = teamfile.value("Team/Voicepack", "Default").toString(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
168 |
m_flag = teamfile.value("Team/Flag", "hedgewars").toString(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
169 |
m_difficulty = teamfile.value("Team/Difficulty", 0).toInt(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
170 |
m_rounds = teamfile.value("Team/Rounds", 0).toInt(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
171 |
m_wins = teamfile.value("Team/Wins", 0).toInt(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
172 |
m_campaignProgress = teamfile.value("Team/CampaignProgress", 0).toInt(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
173 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
174 |
{ |
3333 | 175 |
QString hh = QString("Hedgehog%1/").arg(i); |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
176 |
m_hedgehogs[i].Name = teamfile.value(hh + "Name", QString("hedgehog %1").arg(i+1)).toString(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
177 |
m_hedgehogs[i].Hat = teamfile.value(hh + "Hat", "NoHat").toString(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
178 |
m_hedgehogs[i].Rounds = teamfile.value(hh + "Rounds", 0).toInt(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
179 |
m_hedgehogs[i].Kills = teamfile.value(hh + "Kills", 0).toInt(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
180 |
m_hedgehogs[i].Deaths = teamfile.value(hh + "Deaths", 0).toInt(); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
181 |
m_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
|
182 |
} |
3333 | 183 |
for(int i = 0; i < BINDS_NUMBER; i++) |
6024 | 184 |
m_binds[i].strbind = teamfile.value(QString("Binds/%1").arg(m_binds[i].action), cbinds[i].strbind).toString(); |
3344 | 185 |
for(int i = 0; i < MAX_ACHIEVEMENTS; i++) |
186 |
if(achievements[i][0][0]) |
|
187 |
AchievementProgress[i] = teamfile.value(QString("Achievements/%1").arg(achievements[i][0]), 0).toUInt(); |
|
188 |
else |
|
189 |
break; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
190 |
return true; |
184 | 191 |
} |
192 |
||
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
193 |
bool HWTeam::fileExists() |
3381 | 194 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
195 |
QFile f(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt"); |
3381 | 196 |
return f.exists(); |
197 |
} |
|
198 |
||
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
199 |
bool HWTeam::deleteFile() |
3159 | 200 |
{ |
201 |
if(m_isNetTeam) |
|
202 |
return false; |
|
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
203 |
QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt"); |
3159 | 204 |
cfgfile.remove(); |
205 |
return true; |
|
206 |
} |
|
207 |
||
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
208 |
bool HWTeam::saveToFile() |
184 | 209 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
210 |
if (OldTeamName != m_name) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
211 |
{ |
3758 | 212 |
QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + OldTeamName + ".hwt"); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
213 |
cfgfile.remove(); |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
214 |
OldTeamName = m_name; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
215 |
} |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
216 |
QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt", QSettings::IniFormat, 0); |
3333 | 217 |
teamfile.setIniCodec("UTF-8"); |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
218 |
teamfile.setValue("Team/Name", m_name); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
219 |
teamfile.setValue("Team/Grave", m_grave); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
220 |
teamfile.setValue("Team/Fort", m_fort); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
221 |
teamfile.setValue("Team/Voicepack", m_voicepack); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
222 |
teamfile.setValue("Team/Flag", m_flag); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
223 |
teamfile.setValue("Team/Difficulty", m_difficulty); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
224 |
teamfile.setValue("Team/Rounds", m_rounds); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
225 |
teamfile.setValue("Team/Wins", m_wins); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
226 |
teamfile.setValue("Team/CampaignProgress", m_campaignProgress); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
227 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
228 |
{ |
3333 | 229 |
QString hh = QString("Hedgehog%1/").arg(i); |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
230 |
teamfile.setValue(hh + "Name", m_hedgehogs[i].Name); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
231 |
teamfile.setValue(hh + "Hat", m_hedgehogs[i].Hat); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
232 |
teamfile.setValue(hh + "Rounds", m_hedgehogs[i].Rounds); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
233 |
teamfile.setValue(hh + "Kills", m_hedgehogs[i].Kills); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
234 |
teamfile.setValue(hh + "Deaths", m_hedgehogs[i].Deaths); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
235 |
teamfile.setValue(hh + "Suicides", m_hedgehogs[i].Suicides); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
236 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
237 |
for(int i = 0; i < BINDS_NUMBER; i++) |
6024 | 238 |
teamfile.setValue(QString("Binds/%1").arg(m_binds[i].action), m_binds[i].strbind); |
3344 | 239 |
for(int i = 0; i < MAX_ACHIEVEMENTS; i++) |
240 |
if(achievements[i][0][0]) |
|
241 |
teamfile.setValue(QString("Achievements/%1").arg(achievements[i][0]), AchievementProgress[i]); |
|
242 |
else |
|
243 |
break; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
244 |
return true; |
184 | 245 |
} |
246 |
||
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
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 |
{ |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
252 |
sl.push_back(QString("eaddteam %3 %1 %2").arg(m_color.rgb() & 0xffffff).arg(m_name).arg(QString(QCryptographicHash::hash(m_owner.toLatin1(), QCryptographicHash::Md5).toHex()))); |
2948
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 |
} |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
255 |
else sl.push_back(QString("eaddteam %3 %1 %2").arg(m_color.rgb() & 0xffffff).arg(m_name).arg(playerHash)); |
606
9d800fdfd3bd
Add ammostores in frontend, should help further ammostores implemetation
unc0rr
parents:
605
diff
changeset
|
256 |
|
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
257 |
sl.push_back(QString("egrave " + m_grave)); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
258 |
sl.push_back(QString("efort " + m_fort)); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
259 |
sl.push_back(QString("evoicepack " + m_voicepack)); |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
260 |
sl.push_back(QString("eflag " + m_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++) |
6024 | 264 |
if(!m_binds[i].strbind.isEmpty()) |
265 |
sl.push_back(QString("ebind " + m_binds[i].strbind + " " + m_binds[i].action)); |
|
341 | 266 |
|
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
267 |
for (int t = 0; t < m_numHedgehogs; t++) |
2948
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") |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
270 |
.arg(QString::number(m_difficulty), |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
271 |
QString::number(InitHealth), |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
272 |
m_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") |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
274 |
.arg(m_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 { |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
286 |
return m_name==t1.m_name; |
184 | 287 |
} |
288 |
||
289 |
bool HWTeam::operator<(const HWTeam& t1) const { |
|
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
290 |
return m_name<t1.m_name; // if names are equal - test if it is net team |
184 | 291 |
} |
1840 | 292 |
|
293 |
||
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
294 |
//// Methods for member inspection+modification //// |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
295 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
296 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
297 |
// name |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
298 |
QString HWTeam::name() const { return m_name; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
299 |
void HWTeam::setName(const QString & name) { m_name = name; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
300 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
301 |
// single hedgehog |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
302 |
const HWHog & HWTeam::hedgehog(unsigned int idx) const { return m_hedgehogs[idx]; } |
6024 | 303 |
void HWTeam::setHedgehog(unsigned int idx, HWHog hh) { m_hedgehogs[idx] = hh; } |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
304 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
305 |
// owner |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
306 |
QString HWTeam::owner() const { return m_owner; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
307 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
308 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
309 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
310 |
// difficulty |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
311 |
unsigned int HWTeam::difficulty() const { return m_difficulty; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
312 |
void HWTeam::setDifficulty(unsigned int level) { m_difficulty = level; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
313 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
314 |
// color |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
315 |
QColor HWTeam::color() const { return m_color; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
316 |
void HWTeam::setColor(const QColor & color) { m_color = color; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
317 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
318 |
|
6024 | 319 |
// binds |
320 |
QString HWTeam::keyBind(unsigned int idx) const { return m_binds[idx].strbind; } |
|
321 |
void HWTeam::bindKey(unsigned int idx, const QString & key) { m_binds[idx].strbind = key; } |
|
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
322 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
323 |
// flag |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
324 |
void HWTeam::setFlag(const QString & flag) { m_flag = flag; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
325 |
QString HWTeam::flag() const { return m_flag; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
326 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
327 |
// fort |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
328 |
void HWTeam::setFort(const QString & fort) { m_fort = fort; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
329 |
QString HWTeam::fort() const { return m_fort; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
330 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
331 |
// grave |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
332 |
void HWTeam::setGrave(const QString & grave) { m_grave = grave; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
333 |
QString HWTeam::grave() const { return m_grave; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
334 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
335 |
// voicepack - getter/setter |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
336 |
void HWTeam::setVoicepack(const QString & voicepack) { m_voicepack = voicepack; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
337 |
QString HWTeam::voicepack() const { return m_voicepack; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
338 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
339 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
340 |
// campaignProgress - getter |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
341 |
unsigned int HWTeam::campaignProgress() const { return m_campaignProgress; }; |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
342 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
343 |
// amount of hedgehogs |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
344 |
unsigned char HWTeam::numHedgehogs() const { return m_numHedgehogs; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
345 |
void HWTeam::setNumHedgehogs(unsigned char num) { m_numHedgehogs = num; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
346 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
347 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
348 |
|
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
349 |
// rounds+wins - incrementors |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
350 |
void HWTeam::incRounds() { m_rounds++; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
351 |
void HWTeam::incWins() { m_wins++; } |
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5907
diff
changeset
|
352 |