qmlfrontend/team.cpp
author alfadur
Mon, 19 Nov 2018 06:57:36 +0300
changeset 14235 3a9e4f35aa68
parent 14143 745c73e0e644
child 14291 f1a5b7baa87f
permissions -rw-r--r--
On a second though, the actual error seems to be elsewhere, so still can use proper indexing

#include "team.h"

Hedgehog::Hedgehog()
    : name(QObject::tr("unnamed", "default hedgehog name").toUtf8())
    , hat("NoHat")
    , hp(100)
    , level(0)
{
}

Team::Team()
    : name(QObject::tr("unnamed", "default team name").toUtf8())
    , color("12345678")
    , m_hedgehogsNumber(4)
{
    m_hedgehogs.resize(8);
}

void Team::resize(int number)
{
    m_hedgehogsNumber = number;
}

QVector<Hedgehog> Team::hedgehogs() const
{
    return m_hedgehogs.mid(0, m_hedgehogsNumber);
}