author | Wuzzy <Wuzzy2@mail.ru> |
Tue, 07 Aug 2018 01:31:50 +0200 | |
changeset 13625 | 211a37eb6a29 |
parent 13289 | b504131f7405 |
child 13713 | 3264a26bbf8b |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
11046 | 3 |
* Copyright (c) 2004-2015 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 |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
184 | 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> |
7130 | 25 |
#include <QStandardItemModel> |
8346 | 26 |
#include <QDebug> |
5252 | 27 |
|
184 | 28 |
#include "team.h" |
29 |
#include "hwform.h" |
|
7258 | 30 |
#include "DataManager.h" |
8346 | 31 |
#include "gameuiconfig.h" |
314 | 32 |
|
1325 | 33 |
HWTeam::HWTeam(const QString & teamname) : |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
34 |
QObject(0) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
35 |
, m_difficulty(0) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
36 |
, m_numHedgehogs(4) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
37 |
, m_isNetTeam(false) |
184 | 38 |
{ |
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
|
39 |
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
|
40 |
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
|
41 |
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
|
42 |
{ |
7131 | 43 |
m_hedgehogs.append(HWHog()); |
13085
23a498a2b5b8
Capitalize default hog names and server name
Wuzzy <Wuzzy2@mail.ru>
parents:
12675
diff
changeset
|
44 |
m_hedgehogs[i].Name = (QLineEdit::tr("Hedgehog %1").arg(i+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
|
45 |
m_hedgehogs[i].Hat = "NoHat"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
46 |
} |
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
|
47 |
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
|
48 |
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
|
49 |
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
|
50 |
m_flag = "hedgewars"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
51 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
52 |
{ |
7131 | 53 |
m_binds.append(BindAction()); |
6024 | 54 |
m_binds[i].action = cbinds[i].action; |
8346 | 55 |
m_binds[i].strbind = QString(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
56 |
} |
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
|
57 |
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
|
58 |
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
|
59 |
m_campaignProgress = 0; |
7145
1d1a14b39400
Fix a bug with wrong state of teams list when color isn't changed manually
unc0rr
parents:
7133
diff
changeset
|
60 |
m_color = 0; |
184 | 61 |
} |
62 |
||
353 | 63 |
HWTeam::HWTeam(const QStringList& strLst) : |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
64 |
QObject(0) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
65 |
, m_numHedgehogs(4) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
66 |
, m_isNetTeam(true) |
314 | 67 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
68 |
// net teams are configured from QStringList |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
69 |
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
|
70 |
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
|
71 |
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
|
72 |
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
|
73 |
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
|
74 |
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
|
75 |
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
|
76 |
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
|
77 |
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
|
78 |
{ |
7131 | 79 |
m_hedgehogs.append(HWHog()); |
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
|
80 |
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
|
81 |
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
|
82 |
// 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
|
83 |
// 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
|
84 |
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
|
85 |
} |
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
|
86 |
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
|
87 |
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
|
88 |
m_campaignProgress = 0; |
7145
1d1a14b39400
Fix a bug with wrong state of teams list when color isn't changed manually
unc0rr
parents:
7133
diff
changeset
|
89 |
m_color = 0; |
314 | 90 |
} |
91 |
||
1907 | 92 |
HWTeam::HWTeam() : |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
93 |
QObject(0) |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
94 |
, m_difficulty(0) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
95 |
, m_numHedgehogs(4) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
96 |
, m_isNetTeam(false) |
184 | 97 |
{ |
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
|
98 |
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
|
99 |
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
|
100 |
{ |
7131 | 101 |
m_hedgehogs.append(HWHog()); |
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
|
102 |
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
|
103 |
m_hedgehogs[i].Hat = "NoHat"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
104 |
} |
1840 | 105 |
|
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
|
106 |
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
|
107 |
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
|
108 |
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
|
109 |
m_flag = "hedgewars"; |
1907 | 110 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
111 |
for(int i = 0; i < BINDS_NUMBER; i++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
112 |
{ |
7131 | 113 |
m_binds.append(BindAction()); |
6024 | 114 |
m_binds[i].action = cbinds[i].action; |
8346 | 115 |
m_binds[i].strbind = QString(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
116 |
} |
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
|
117 |
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
|
118 |
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
|
119 |
m_campaignProgress = 0; |
7145
1d1a14b39400
Fix a bug with wrong state of teams list when color isn't changed manually
unc0rr
parents:
7133
diff
changeset
|
120 |
m_color = 0; |
184 | 121 |
} |
122 |
||
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
|
123 |
HWTeam::HWTeam(const HWTeam & other) : |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
124 |
QObject(0) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
125 |
, OldTeamName(other.OldTeamName) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
126 |
, m_name(other.m_name) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
127 |
, m_grave(other.m_grave) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
128 |
, m_fort(other.m_fort) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
129 |
, m_flag(other.m_flag) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
130 |
, m_voicepack(other.m_voicepack) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
131 |
, m_hedgehogs(other.m_hedgehogs) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
132 |
, m_difficulty(other.m_difficulty) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
133 |
, m_binds(other.m_binds) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
134 |
, m_numHedgehogs(other.m_numHedgehogs) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
135 |
, m_color(other.m_color) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
136 |
, m_isNetTeam(other.m_isNetTeam) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
137 |
, m_owner(other.m_owner) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
138 |
, m_campaignProgress(other.m_campaignProgress) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
139 |
, m_rounds(other.m_rounds) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
140 |
, m_wins(other.m_wins) |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
141 |
// , 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
|
142 |
{ |
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
|
143 |
|
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
|
144 |
} |
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
|
145 |
|
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
|
146 |
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
|
147 |
{ |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
148 |
if(this != &other) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
149 |
{ |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
150 |
OldTeamName = other.OldTeamName; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
151 |
m_name = other.m_name; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
152 |
m_grave = other.m_grave; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
153 |
m_fort = other.m_fort; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
154 |
m_flag = other.m_flag; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
155 |
m_voicepack = other.m_voicepack; |
7254 | 156 |
m_hedgehogs = other.m_hedgehogs; |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
157 |
m_difficulty = other.m_difficulty; |
7254 | 158 |
m_binds = other.m_binds; |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
159 |
m_numHedgehogs = other.m_numHedgehogs; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
160 |
m_color = other.m_color; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
161 |
m_isNetTeam = other.m_isNetTeam; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
162 |
m_owner = other.m_owner; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
163 |
m_campaignProgress = other.m_campaignProgress; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
164 |
m_rounds = other.m_rounds; |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
165 |
m_wins = other.m_wins; |
7145
1d1a14b39400
Fix a bug with wrong state of teams list when color isn't changed manually
unc0rr
parents:
7133
diff
changeset
|
166 |
m_color = other.m_color; |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
167 |
} |
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
|
168 |
|
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
169 |
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
|
170 |
} |
184 | 171 |
|
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
|
172 |
bool HWTeam::loadFromFile() |
184 | 173 |
{ |
13289
b504131f7405
Fix team files and settings not saving properly, and remove FileEngine stuff from DLC
Wuzzy <Wuzzy2@mail.ru>
parents:
13085
diff
changeset
|
174 |
QSettings teamfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name)), QSettings::IniFormat, 0); |
3333 | 175 |
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
|
176 |
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
|
177 |
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
|
178 |
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
|
179 |
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
|
180 |
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
|
181 |
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
|
182 |
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
|
183 |
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
|
184 |
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
|
185 |
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
|
186 |
{ |
3333 | 187 |
QString hh = QString("Hedgehog%1/").arg(i); |
13085
23a498a2b5b8
Capitalize default hog names and server name
Wuzzy <Wuzzy2@mail.ru>
parents:
12675
diff
changeset
|
188 |
m_hedgehogs[i].Name = teamfile.value(hh + "Name", QString("Hedgehog %1").arg(i+1)).toString(); |
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
|
189 |
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
|
190 |
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
|
191 |
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
|
192 |
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
|
193 |
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
|
194 |
} |
3333 | 195 |
for(int i = 0; i < BINDS_NUMBER; i++) |
8346 | 196 |
m_binds[i].strbind = teamfile.value(QString("Binds/%1").arg(m_binds[i].action), QString()).toString(); |
3344 | 197 |
for(int i = 0; i < MAX_ACHIEVEMENTS; i++) |
198 |
if(achievements[i][0][0]) |
|
199 |
AchievementProgress[i] = teamfile.value(QString("Achievements/%1").arg(achievements[i][0]), 0).toUInt(); |
|
200 |
else |
|
201 |
break; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
202 |
return true; |
184 | 203 |
} |
204 |
||
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
|
205 |
bool HWTeam::fileExists() |
3381 | 206 |
{ |
13289
b504131f7405
Fix team files and settings not saving properly, and remove FileEngine stuff from DLC
Wuzzy <Wuzzy2@mail.ru>
parents:
13085
diff
changeset
|
207 |
QFile f(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name))); |
3381 | 208 |
return f.exists(); |
209 |
} |
|
210 |
||
12675
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
211 |
// Returns true if the team name has been changed but a file with the same team name already exists. |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
212 |
// So if this team would be saved, another team file would be overwritten, which is generally not |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
213 |
// desired. |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
214 |
bool HWTeam::wouldOverwriteOtherFile() |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
215 |
{ |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
216 |
return (m_name != OldTeamName) && fileExists(); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
217 |
} |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
218 |
|
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
|
219 |
bool HWTeam::deleteFile() |
3159 | 220 |
{ |
221 |
if(m_isNetTeam) |
|
222 |
return false; |
|
13289
b504131f7405
Fix team files and settings not saving properly, and remove FileEngine stuff from DLC
Wuzzy <Wuzzy2@mail.ru>
parents:
13085
diff
changeset
|
223 |
QFile cfgfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name))); |
3159 | 224 |
cfgfile.remove(); |
225 |
return true; |
|
226 |
} |
|
227 |
||
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
|
228 |
bool HWTeam::saveToFile() |
184 | 229 |
{ |
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 |
if (OldTeamName != m_name) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
231 |
{ |
13289
b504131f7405
Fix team files and settings not saving properly, and remove FileEngine stuff from DLC
Wuzzy <Wuzzy2@mail.ru>
parents:
13085
diff
changeset
|
232 |
QFile cfgfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(OldTeamName))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
233 |
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
|
234 |
OldTeamName = m_name; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
235 |
} |
8098 | 236 |
|
13289
b504131f7405
Fix team files and settings not saving properly, and remove FileEngine stuff from DLC
Wuzzy <Wuzzy2@mail.ru>
parents:
13085
diff
changeset
|
237 |
QString fileName = QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name)); |
8508
f849b7b3af1d
- Ensure that team file exists before saving into it (same fix as for hedgewars.ini, due to bug in Qt)
unc0rr
parents:
8346
diff
changeset
|
238 |
DataManager::ensureFileExists(fileName); |
f849b7b3af1d
- Ensure that team file exists before saving into it (same fix as for hedgewars.ini, due to bug in Qt)
unc0rr
parents:
8346
diff
changeset
|
239 |
QSettings teamfile(fileName, QSettings::IniFormat, 0); |
3333 | 240 |
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
|
241 |
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
|
242 |
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
|
243 |
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
|
244 |
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
|
245 |
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
|
246 |
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
|
247 |
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
|
248 |
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
|
249 |
teamfile.setValue("Team/CampaignProgress", m_campaignProgress); |
8098 | 250 |
|
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
|
251 |
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
|
252 |
{ |
3333 | 253 |
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
|
254 |
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
|
255 |
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
|
256 |
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
|
257 |
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
|
258 |
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
|
259 |
teamfile.setValue(hh + "Suicides", m_hedgehogs[i].Suicides); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
260 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
261 |
for(int i = 0; i < BINDS_NUMBER; i++) |
6024 | 262 |
teamfile.setValue(QString("Binds/%1").arg(m_binds[i].action), m_binds[i].strbind); |
3344 | 263 |
for(int i = 0; i < MAX_ACHIEVEMENTS; i++) |
264 |
if(achievements[i][0][0]) |
|
265 |
teamfile.setValue(QString("Achievements/%1").arg(achievements[i][0]), AchievementProgress[i]); |
|
266 |
else |
|
267 |
break; |
|
8098 | 268 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
269 |
return true; |
184 | 270 |
} |
271 |
||
9466 | 272 |
QStringList HWTeam::teamGameConfig(quint32 InitHealth) const |
184 | 273 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
274 |
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
|
275 |
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
|
276 |
{ |
7313
162bc562335b
Use toUtf8 instead TODO - find out 'sactly what the website is using for hashes.
nemo
parents:
7258
diff
changeset
|
277 |
sl.push_back(QString("eaddteam %3 %1 %2").arg(qcolor().rgb() & 0xffffff).arg(m_name).arg(QString(QCryptographicHash::hash(m_owner.toUtf8(), QCryptographicHash::Md5).toHex()))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
278 |
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
|
279 |
} |
7130 | 280 |
else sl.push_back(QString("eaddteam %3 %1 %2").arg(qcolor().rgb() & 0xffffff).arg(m_name).arg(playerHash)); |
606
9d800fdfd3bd
Add ammostores in frontend, should help further ammostores implemetation
unc0rr
parents:
605
diff
changeset
|
281 |
|
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
|
282 |
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
|
283 |
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
|
284 |
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
|
285 |
sl.push_back(QString("eflag " + m_flag)); |
341 | 286 |
|
9790 | 287 |
if(!m_owner.isEmpty()) |
9791
446e4919b738
Display team owner in teams widget (addresses issue 174)
unc0rr
parents:
9790
diff
changeset
|
288 |
sl.push_back(QString("eowner ") + m_owner); |
9790 | 289 |
|
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 |
for (int t = 0; t < m_numHedgehogs; t++) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
291 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
292 |
sl.push_back(QString("eaddhh %1 %2 %3") |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
293 |
.arg(QString::number(m_difficulty), |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
294 |
QString::number(InitHealth), |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
295 |
m_hedgehogs[t].Name)); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
296 |
sl.push_back(QString("ehat %1") |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
297 |
.arg(m_hedgehogs[t].Hat)); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
298 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2879
diff
changeset
|
299 |
return sl; |
184 | 300 |
} |
301 |
||
10400
47e2189eae44
This should make frontend aware of your own teams in game on rejoin
unc0rr
parents:
10108
diff
changeset
|
302 |
|
47e2189eae44
This should make frontend aware of your own teams in game on rejoin
unc0rr
parents:
10108
diff
changeset
|
303 |
void HWTeam::setNetTeam(bool isNetTeam) |
47e2189eae44
This should make frontend aware of your own teams in game on rejoin
unc0rr
parents:
10108
diff
changeset
|
304 |
{ |
47e2189eae44
This should make frontend aware of your own teams in game on rejoin
unc0rr
parents:
10108
diff
changeset
|
305 |
m_isNetTeam = isNetTeam; |
47e2189eae44
This should make frontend aware of your own teams in game on rejoin
unc0rr
parents:
10108
diff
changeset
|
306 |
} |
47e2189eae44
This should make frontend aware of your own teams in game on rejoin
unc0rr
parents:
10108
diff
changeset
|
307 |
|
352 | 308 |
bool HWTeam::isNetTeam() const |
309 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
310 |
return m_isNetTeam; |
352 | 311 |
} |
312 |
||
313 |
||
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
314 |
bool HWTeam::operator==(const HWTeam& t1) const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
315 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
316 |
return m_name==t1.m_name; |
184 | 317 |
} |
318 |
||
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
319 |
bool HWTeam::operator<(const HWTeam& t1) const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
320 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
321 |
return m_name<t1.m_name; // if names are equal - test if it is net team |
184 | 322 |
} |
1840 | 323 |
|
324 |
||
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
|
325 |
//// 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
|
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 |
|
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 |
// name |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
329 |
QString HWTeam::name() const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
330 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
331 |
return m_name; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
332 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
333 |
void HWTeam::setName(const QString & name) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
334 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
335 |
m_name = name; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
336 |
} |
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
|
337 |
|
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 |
// single hedgehog |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
339 |
const HWHog & HWTeam::hedgehog(unsigned int idx) const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
340 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
341 |
return m_hedgehogs[idx]; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
342 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
343 |
void HWTeam::setHedgehog(unsigned int idx, HWHog hh) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
344 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
345 |
m_hedgehogs[idx] = hh; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
346 |
} |
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
|
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 |
// owner |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
349 |
QString HWTeam::owner() const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
350 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
351 |
return m_owner; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
352 |
} |
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
|
353 |
|
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
|
354 |
|
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
|
355 |
|
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
|
356 |
// difficulty |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
357 |
unsigned int HWTeam::difficulty() const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
358 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
359 |
return m_difficulty; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
360 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
361 |
void HWTeam::setDifficulty(unsigned int level) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
362 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
363 |
m_difficulty = level; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
364 |
} |
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
|
365 |
|
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
|
366 |
// color |
7130 | 367 |
int HWTeam::color() const |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
368 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
369 |
return m_color; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
370 |
} |
7130 | 371 |
|
372 |
QColor HWTeam::qcolor() const |
|
373 |
{ |
|
7258 | 374 |
return DataManager::instance().colorsModel()->item(m_color)->data().value<QColor>(); |
7130 | 375 |
} |
376 |
||
377 |
void HWTeam::setColor(int color) |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
378 |
{ |
7258 | 379 |
m_color = color % DataManager::instance().colorsModel()->rowCount(); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
380 |
} |
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
|
381 |
|
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
|
382 |
|
6024 | 383 |
// binds |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
384 |
QString HWTeam::keyBind(unsigned int idx) const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
385 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
386 |
return m_binds[idx].strbind; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
387 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
388 |
void HWTeam::bindKey(unsigned int idx, const QString & key) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
389 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
390 |
m_binds[idx].strbind = key; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
391 |
} |
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
|
392 |
|
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
|
393 |
// flag |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
394 |
void HWTeam::setFlag(const QString & flag) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
395 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
396 |
m_flag = flag; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
397 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
398 |
QString HWTeam::flag() const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
399 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
400 |
return m_flag; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
401 |
} |
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
|
402 |
|
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
|
403 |
// fort |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
404 |
void HWTeam::setFort(const QString & fort) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
405 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
406 |
m_fort = fort; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
407 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
408 |
QString HWTeam::fort() const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
409 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
410 |
return m_fort; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
411 |
} |
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
|
412 |
|
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
|
413 |
// grave |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
414 |
void HWTeam::setGrave(const QString & grave) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
415 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
416 |
m_grave = grave; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
417 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
418 |
QString HWTeam::grave() const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
419 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
420 |
return m_grave; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
421 |
} |
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
|
422 |
|
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
|
423 |
// voicepack - getter/setter |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
424 |
void HWTeam::setVoicepack(const QString & voicepack) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
425 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
426 |
m_voicepack = voicepack; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
427 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
428 |
QString HWTeam::voicepack() const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
429 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
430 |
return m_voicepack; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
431 |
} |
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
|
432 |
|
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
|
433 |
|
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
|
434 |
// campaignProgress - getter |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
435 |
unsigned int HWTeam::campaignProgress() const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
436 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
437 |
return m_campaignProgress; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
438 |
}; |
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
|
439 |
|
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
|
440 |
// amount of hedgehogs |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
441 |
unsigned char HWTeam::numHedgehogs() const |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
442 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
443 |
return m_numHedgehogs; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
444 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
445 |
void HWTeam::setNumHedgehogs(unsigned char num) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
446 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
447 |
m_numHedgehogs = num; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
448 |
} |
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
|
449 |
|
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
|
450 |
|
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
|
451 |
|
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
|
452 |
// rounds+wins - incrementors |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
453 |
void HWTeam::incRounds() |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
454 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
455 |
m_rounds++; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
456 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
457 |
void HWTeam::incWins() |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
458 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
459 |
m_wins++; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6225
diff
changeset
|
460 |
} |
10400
47e2189eae44
This should make frontend aware of your own teams in game on rejoin
unc0rr
parents:
10108
diff
changeset
|
461 |