qmlfrontend/team.cpp
author unc0rr
Wed, 27 Dec 2017 00:59:26 +0100
branchqmlfrontend
changeset 12863 fe16fa088b69
child 14312 f1a5b7baa87f
permissions -rw-r--r--
Make playing a game possible
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12863
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
     1
#include "team.h"
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
     2
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
     3
Hedgehog::Hedgehog()
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
     4
    : name(QObject::tr("unnamed", "default hedgehog name").toUtf8())
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
     5
    , hat("NoHat")
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
     6
    , hp(100)
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
     7
    , level(0)
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
     8
{
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
     9
}
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    10
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    11
Team::Team()
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    12
    : name(QObject::tr("unnamed", "default team name").toUtf8())
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    13
    , color("12345678")
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    14
    , m_hedgehogsNumber(4)
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    15
{
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    16
    m_hedgehogs.resize(8);
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    17
}
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    18
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    19
void Team::resize(int number)
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    20
{
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    21
    m_hedgehogsNumber = number;
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    22
}
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    23
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    24
QVector<Hedgehog> Team::hedgehogs() const
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    25
{
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    26
    return m_hedgehogs.mid(0, m_hedgehogsNumber);
fe16fa088b69 Make playing a game possible
unc0rr
parents:
diff changeset
    27
}