QTfrontend/team.cpp
author unc0rr
Mon, 28 May 2012 00:43:36 +0400
changeset 7131 c0c787eb526e
parent 7130 fcab1fd02bc6
child 7133 9f250f79cb79
permissions -rw-r--r--
Make frontend compile with clang
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 607
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6952
7f70f37bbf08 license header year range adjustments
sheepluva
parents: 6700
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     4
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     8
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    12
 * GNU General Public License for more details.
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    13
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    15
 * along with this program; if not, write to the Free Software
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    17
 */
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    18
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    19
#include <QFile>
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    20
#include <QTextStream>
471
e1eb64ba5e9c Small cleanup, faster compilation as a result
unc0rr
parents: 468
diff changeset
    21
#include <QStringList>
e1eb64ba5e9c Small cleanup, faster compilation as a result
unc0rr
parents: 468
diff changeset
    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
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
    24
#include <QSettings>
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
    25
#include <QStandardItemModel>
5252
ded882439548 file association for mac!
koda
parents: 5204
diff changeset
    26
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    27
#include "team.h"
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    28
#include "hwform.h"
314
83773ccf4f09 client/server net pre-alpha
displacer
parents: 312
diff changeset
    29
1325
c8994d47f41d Adding teams now works
unc0rr
parents: 1293
diff changeset
    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
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    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
    {
7131
c0c787eb526e Make frontend compile with clang
unc0rr
parents: 7130
diff changeset
    40
        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
    41
        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
    42
        m_hedgehogs[i].Hat = "NoHat";
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
    43
    }
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
    44
    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
    45
    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
    46
    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
    47
    m_flag = "hedgewars";
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
    48
    for(int i = 0; i < BINDS_NUMBER; i++)
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
    49
    {
7131
c0c787eb526e Make frontend compile with clang
unc0rr
parents: 7130
diff changeset
    50
        m_binds.append(BindAction());
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6015
diff changeset
    51
        m_binds[i].action = cbinds[i].action;
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6015
diff changeset
    52
        m_binds[i].strbind = cbinds[i].strbind;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
    53
    }
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
    54
    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
    55
    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
    56
    m_campaignProgress = 0;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    57
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    58
353
5ec611d702a0 initial hedgehogs num fixed
displacer
parents: 352
diff changeset
    59
HWTeam::HWTeam(const QStringList& strLst) :
6225
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
    60
    QObject(0)
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
    61
    , m_numHedgehogs(4)
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
    62
    , m_isNetTeam(true)
314
83773ccf4f09 client/server net pre-alpha
displacer
parents: 312
diff changeset
    63
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
    64
    // net teams are configured from QStringList
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
    65
    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
    66
    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
    67
    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
    68
    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
    69
    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
    70
    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
    71
    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
    72
    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
    73
    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
    74
    {
7131
c0c787eb526e Make frontend compile with clang
unc0rr
parents: 7130
diff changeset
    75
        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
    76
        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
    77
        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
    78
// 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
    79
// 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
    80
        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
    81
    }
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
    82
    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
    83
    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
    84
    m_campaignProgress = 0;
314
83773ccf4f09 client/server net pre-alpha
displacer
parents: 312
diff changeset
    85
}
83773ccf4f09 client/server net pre-alpha
displacer
parents: 312
diff changeset
    86
1907
a104432e8301 Random team generator rework by ttsmj
unc0rr
parents: 1840
diff changeset
    87
HWTeam::HWTeam() :
6225
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
    88
    QObject(0)
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
    89
    , m_difficulty(0)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
    90
    , m_numHedgehogs(4)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
    91
    , m_isNetTeam(false)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
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_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
    94
    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
    95
    {
7131
c0c787eb526e Make frontend compile with clang
unc0rr
parents: 7130
diff changeset
    96
        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
    97
        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
    98
        m_hedgehogs[i].Hat = "NoHat";
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
    99
    }
1840
4747f0232b88 ttsmj2's random teams patch
unc0rr
parents: 1683
diff changeset
   100
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
   101
    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
   102
    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
   103
    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
   104
    m_flag = "hedgewars";
1907
a104432e8301 Random team generator rework by ttsmj
unc0rr
parents: 1840
diff changeset
   105
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   106
    for(int i = 0; i < BINDS_NUMBER; i++)
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   107
    {
7131
c0c787eb526e Make frontend compile with clang
unc0rr
parents: 7130
diff changeset
   108
        m_binds.append(BindAction());
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6015
diff changeset
   109
        m_binds[i].action = cbinds[i].action;
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6015
diff changeset
   110
        m_binds[i].strbind = cbinds[i].strbind;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   111
    }
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
   112
    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
   113
    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
   114
    m_campaignProgress = 0;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   115
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   116
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
   117
HWTeam::HWTeam(const HWTeam & other) :
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   118
    QObject(0)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   119
    , OldTeamName(other.OldTeamName)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   120
    , m_name(other.m_name)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   121
    , m_grave(other.m_grave)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   122
    , m_fort(other.m_fort)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   123
    , m_flag(other.m_flag)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   124
    , m_voicepack(other.m_voicepack)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   125
    , m_hedgehogs(other.m_hedgehogs)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   126
    , m_difficulty(other.m_difficulty)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   127
    , m_binds(other.m_binds)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   128
    , m_numHedgehogs(other.m_numHedgehogs)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   129
    , m_color(other.m_color)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   130
    , m_isNetTeam(other.m_isNetTeam)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   131
    , m_owner(other.m_owner)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   132
    , m_campaignProgress(other.m_campaignProgress)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   133
    , m_rounds(other.m_rounds)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   134
    , m_wins(other.m_wins)
6225
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   135
//      , 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
   136
{
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
   137
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
   138
}
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
   139
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
   140
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
   141
{
6225
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   142
    if(this != &other)
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   143
    {
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   144
        OldTeamName = other.OldTeamName;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   145
        m_name = other.m_name;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   146
        m_grave = other.m_grave;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   147
        m_fort = other.m_fort;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   148
        m_flag = other.m_flag;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   149
        m_voicepack = other.m_voicepack;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   150
//        m_hedgehogs = other.m_hedgehogs;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   151
        m_difficulty = other.m_difficulty;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   152
//        m_binds = other.m_binds;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   153
        m_numHedgehogs = other.m_numHedgehogs;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   154
        m_color = other.m_color;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   155
        m_isNetTeam = other.m_isNetTeam;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   156
        m_owner = other.m_owner;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   157
        m_campaignProgress = other.m_campaignProgress;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   158
        m_rounds = other.m_rounds;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   159
        m_wins = other.m_wins;
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   160
    }
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
   161
6225
505643d4c23d disconnect when going back from lobby page (regression fix)
sheepluva
parents: 6223
diff changeset
   162
    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
   163
}
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   164
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
   165
bool HWTeam::loadFromFile()
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   166
{
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
   167
    QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt", QSettings::IniFormat, 0);
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   168
    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
   169
    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
   170
    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
   171
    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
   172
    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
   173
    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
   174
    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
   175
    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
   176
    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
   177
    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
   178
    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
   179
    {
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   180
        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
   181
        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
   182
        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
   183
        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
   184
        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
   185
        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
   186
        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
   187
    }
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   188
    for(int i = 0; i < BINDS_NUMBER; i++)
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6015
diff changeset
   189
        m_binds[i].strbind = teamfile.value(QString("Binds/%1").arg(m_binds[i].action), cbinds[i].strbind).toString();
3344
b18a166e6ca4 Frontend:
smxx
parents: 3333
diff changeset
   190
    for(int i = 0; i < MAX_ACHIEVEMENTS; i++)
b18a166e6ca4 Frontend:
smxx
parents: 3333
diff changeset
   191
        if(achievements[i][0][0])
b18a166e6ca4 Frontend:
smxx
parents: 3333
diff changeset
   192
            AchievementProgress[i] = teamfile.value(QString("Achievements/%1").arg(achievements[i][0]), 0).toUInt();
b18a166e6ca4 Frontend:
smxx
parents: 3333
diff changeset
   193
        else
b18a166e6ca4 Frontend:
smxx
parents: 3333
diff changeset
   194
            break;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   195
    return true;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   196
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   197
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
   198
bool HWTeam::fileExists()
3381
f8800c44b3de Engine:
smxx
parents: 3359
diff changeset
   199
{
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
   200
    QFile f(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt");
3381
f8800c44b3de Engine:
smxx
parents: 3359
diff changeset
   201
    return f.exists();
f8800c44b3de Engine:
smxx
parents: 3359
diff changeset
   202
}
f8800c44b3de Engine:
smxx
parents: 3359
diff changeset
   203
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
   204
bool HWTeam::deleteFile()
3159
e5eff81d7635 Frontend:
smxx
parents: 2948
diff changeset
   205
{
e5eff81d7635 Frontend:
smxx
parents: 2948
diff changeset
   206
    if(m_isNetTeam)
e5eff81d7635 Frontend:
smxx
parents: 2948
diff changeset
   207
        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
   208
    QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt");
3159
e5eff81d7635 Frontend:
smxx
parents: 2948
diff changeset
   209
    cfgfile.remove();
e5eff81d7635 Frontend:
smxx
parents: 2948
diff changeset
   210
    return true;
e5eff81d7635 Frontend:
smxx
parents: 2948
diff changeset
   211
}
e5eff81d7635 Frontend:
smxx
parents: 2948
diff changeset
   212
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
   213
bool HWTeam::saveToFile()
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   214
{
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
   215
    if (OldTeamName != m_name)
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   216
    {
3758
80007c41c35e Frontend:
smaxx
parents: 3697
diff changeset
   217
        QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + OldTeamName + ".hwt");
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   218
        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
   219
        OldTeamName = m_name;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   220
    }
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
   221
    QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt", QSettings::IniFormat, 0);
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   222
    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
   223
    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
   224
    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
   225
    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
   226
    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
   227
    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
   228
    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
   229
    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
   230
    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
   231
    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
   232
    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
   233
    {
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   234
        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
   235
        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
   236
        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
   237
        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
   238
        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
   239
        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
   240
        teamfile.setValue(hh + "Suicides", m_hedgehogs[i].Suicides);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   241
    }
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   242
    for(int i = 0; i < BINDS_NUMBER; i++)
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6015
diff changeset
   243
        teamfile.setValue(QString("Binds/%1").arg(m_binds[i].action), m_binds[i].strbind);
3344
b18a166e6ca4 Frontend:
smxx
parents: 3333
diff changeset
   244
    for(int i = 0; i < MAX_ACHIEVEMENTS; i++)
b18a166e6ca4 Frontend:
smxx
parents: 3333
diff changeset
   245
        if(achievements[i][0][0])
b18a166e6ca4 Frontend:
smxx
parents: 3333
diff changeset
   246
            teamfile.setValue(QString("Achievements/%1").arg(achievements[i][0]), AchievementProgress[i]);
b18a166e6ca4 Frontend:
smxx
parents: 3333
diff changeset
   247
        else
b18a166e6ca4 Frontend:
smxx
parents: 3333
diff changeset
   248
            break;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   249
    return true;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   250
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
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
QStringList HWTeam::teamGameConfig(quint32 InitHealth) const
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   253
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   254
    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
   255
    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
   256
    {
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
   257
        sl.push_back(QString("eaddteam %3 %1 %2").arg(qcolor().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
   258
        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
   259
    }
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
   260
    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
   261
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
   262
    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
   263
    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
   264
    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
   265
    sl.push_back(QString("eflag " + m_flag));
341
184230eb4151 - Store more team specific values in HWTeam
unc0rr
parents: 339
diff changeset
   266
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   267
    if (!m_isNetTeam)
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   268
        for(int i = 0; i < BINDS_NUMBER; i++)
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6015
diff changeset
   269
            if(!m_binds[i].strbind.isEmpty())
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6015
diff changeset
   270
                sl.push_back(QString("ebind " + m_binds[i].strbind + " " + m_binds[i].action));
341
184230eb4151 - Store more team specific values in HWTeam
unc0rr
parents: 339
diff changeset
   271
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
    for (int t = 0; t < m_numHedgehogs; t++)
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   273
    {
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   274
        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
   275
                     .arg(QString::number(m_difficulty),
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   276
                          QString::number(InitHealth),
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   277
                          m_hedgehogs[t].Name));
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   278
        sl.push_back(QString("ehat %1")
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   279
                     .arg(m_hedgehogs[t].Hat));
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   280
    }
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2879
diff changeset
   281
    return sl;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   282
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   283
352
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
   284
bool HWTeam::isNetTeam() const
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
   285
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   286
    return m_isNetTeam;
352
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
   287
}
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
   288
4665bfe25470 first buggy hedgehogs num net change
displacer
parents: 348
diff changeset
   289
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   290
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
   291
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   292
    return m_name==t1.m_name;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   293
}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   294
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   295
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
   296
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   297
    return m_name<t1.m_name; // if names are equal - test if it is net team
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   298
}
1840
4747f0232b88 ttsmj2's random teams patch
unc0rr
parents: 1683
diff changeset
   299
4747f0232b88 ttsmj2's random teams patch
unc0rr
parents: 1683
diff changeset
   300
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
   301
//// 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
   302
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   303
daffc14a518a cleaning up 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
// name
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   305
QString HWTeam::name() const
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   306
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   307
    return m_name;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   308
}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   309
void HWTeam::setName(const QString & name)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   310
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   311
    m_name = name;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   312
}
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
   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
// single hedgehog
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   315
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
   316
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   317
    return m_hedgehogs[idx];
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   318
}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   319
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
   320
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   321
    m_hedgehogs[idx] = hh;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   322
}
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
   323
daffc14a518a cleaning up 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
// owner
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   325
QString HWTeam::owner() const
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   326
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   327
    return m_owner;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   328
}
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
   329
daffc14a518a cleaning up 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
daffc14a518a cleaning up 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
// difficulty
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   333
unsigned int HWTeam::difficulty() const
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
    return m_difficulty;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   336
}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   337
void HWTeam::setDifficulty(unsigned int level)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   338
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   339
    m_difficulty = level;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   340
}
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
   341
daffc14a518a cleaning up 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
// color
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
   343
int HWTeam::color() const
6616
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
    return m_color;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   346
}
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
   347
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
   348
QColor HWTeam::qcolor() const
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
   349
{
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
   350
    return colorsModel->item(m_color)->data().value<QColor>();
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
   351
}
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
   352
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6953
diff changeset
   353
void HWTeam::setColor(int color)
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   354
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   355
    m_color = color;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   356
}
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
   357
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   358
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6015
diff changeset
   359
// binds
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   360
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
   361
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   362
    return m_binds[idx].strbind;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   363
}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   364
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
   365
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   366
    m_binds[idx].strbind = key;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   367
}
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
   368
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   369
// flag
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   370
void    HWTeam::setFlag(const QString & flag)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   371
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   372
    m_flag = flag;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   373
}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   374
QString HWTeam::flag() const
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   375
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   376
    return m_flag;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   377
}
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
   378
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   379
// fort
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   380
void    HWTeam::setFort(const QString & fort)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   381
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   382
    m_fort = fort;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   383
}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   384
QString HWTeam::fort() 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_fort;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   387
}
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
   388
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   389
// grave
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   390
void HWTeam::setGrave(const QString & grave)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   391
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   392
    m_grave = grave;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   393
}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   394
QString HWTeam::grave() const
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
    return m_grave;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   397
}
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
   398
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   399
// voicepack - getter/setter
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   400
void HWTeam::setVoicepack(const QString & voicepack)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   401
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   402
    m_voicepack = voicepack;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   403
}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   404
QString HWTeam::voicepack() const
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
    return m_voicepack;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   407
}
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
   408
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   409
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   410
// campaignProgress - getter
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   411
unsigned int HWTeam::campaignProgress() const
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   412
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   413
    return m_campaignProgress;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   414
};
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
   415
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   416
// amount of hedgehogs
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   417
unsigned char HWTeam::numHedgehogs() const
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   418
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   419
    return m_numHedgehogs;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   420
}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   421
void HWTeam::setNumHedgehogs(unsigned char num)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   422
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   423
    m_numHedgehogs = num;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   424
}
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
   425
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   426
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   427
daffc14a518a cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents: 5907
diff changeset
   428
// rounds+wins - incrementors
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   429
void HWTeam::incRounds()
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   430
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   431
    m_rounds++;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   432
}
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   433
void HWTeam::incWins()
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   434
{
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   435
    m_wins++;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6225
diff changeset
   436
}