cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
--- a/QTfrontend/frameTeam.cpp Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/frameTeam.cpp Sat Sep 24 22:14:10 2011 +0200
@@ -99,14 +99,14 @@
{
TeamShowWidget* pTeamShowWidget = dynamic_cast<TeamShowWidget*>(getTeamWidget(team));
if(!pTeamShowWidget) return;
- pTeamShowWidget->setHHNum(team.numHedgehogs);
+ pTeamShowWidget->setHHNum(team.numHedgehogs());
}
void FrameTeams::setTeamColor(const HWTeam& team)
{
TeamShowWidget* pTeamShowWidget = dynamic_cast<TeamShowWidget*>(getTeamWidget(team));
if(!pTeamShowWidget) return;
- pTeamShowWidget->changeTeamColor(team.teamColor);
+ pTeamShowWidget->changeTeamColor(team.color());
}
QWidget* FrameTeams::getTeamWidget(HWTeam team)
--- a/QTfrontend/game.cpp Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/game.cpp Sat Sep 24 22:14:10 2011 +0200
@@ -99,7 +99,7 @@
HWProto::addStringToBuffer(buf, QString("eammreinf %1").arg(ammostr.mid(3 * cAmmoNumber, cAmmoNumber)));
if(!gamecfg->schemeData(21).toBool()) HWProto::addStringToBuffer(buf, QString("eammstore"));
HWProto::addStringListToBuffer(buf,
- team.TeamGameConfig(gamecfg->getInitHealth()));
+ team.teamGameConfig(gamecfg->getInitHealth()));
;
}
}
@@ -122,25 +122,23 @@
HWNamegen namegen;
- HWTeam * team1;
- team1 = new HWTeam;
- team1->difficulty = 0;
- team1->teamColor = QColor(colors[0]);
- team1->numHedgehogs = 4;
- namegen.TeamRandomNames(team1,TRUE);
+ HWTeam team1;
+ team1.setDifficulty(0);
+ team1.setColor(QColor(colors[0]));
+ team1.setNumHedgehogs(4);
+ namegen.teamRandomNames(team1,TRUE);
HWProto::addStringListToBuffer(teamscfg,
- team1->TeamGameConfig(100));
+ team1.teamGameConfig(100));
- HWTeam * team2;
- team2 = new HWTeam;
- team2->difficulty = 4;
- team2->teamColor = QColor(colors[1]);
- team2->numHedgehogs = 4;
- do
- namegen.TeamRandomNames(team2,TRUE);
- while(!team2->TeamName.compare(team1->TeamName) || !team2->Hedgehogs[0].Hat.compare(team1->Hedgehogs[0].Hat));
+ HWTeam team2;
+ team2.setDifficulty(4);
+ team2.setColor(QColor(colors[1]));
+ team2.setNumHedgehogs(4);
+ do
+ namegen.teamRandomNames(team2,TRUE);
+ while(!team2.name().compare(team1.name()) || !team2.hedgehog(0).Hat.compare(team1.hedgehog(0).Hat));
HWProto::addStringListToBuffer(teamscfg,
- team2->TeamGameConfig(100));
+ team2.teamGameConfig(100));
HWProto::addStringToBuffer(teamscfg, QString("eammloadt %1").arg(cDefaultAmmoStore->mid(0, cAmmoNumber)));
HWProto::addStringToBuffer(teamscfg, QString("eammprob %1").arg(cDefaultAmmoStore->mid(cAmmoNumber, cAmmoNumber)));
@@ -400,7 +398,7 @@
{
QByteArray buf;
foreach(HWTeam team, m_pTeamSelWidget->getPlayingTeams())
- HWProto::addStringToBuffer(buf, QString("eteamgone %1").arg(team.TeamName));
+ HWProto::addStringToBuffer(buf, QString("eteamgone %1").arg(team.name()));
RawSendIPC(buf);
}
}
--- a/QTfrontend/hwconsts.h Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/hwconsts.h Sat Sep 24 22:14:10 2011 +0200
@@ -58,6 +58,8 @@
extern bool isDevBuild;
#endif
+#define HEDGEHOGS_PER_TEAM 8
+
#define AMMOLINE_DEFAULT_QT "939192942219912103223511100120100000021111010101111101"
#define AMMOLINE_DEFAULT_PROB "040504054160065554655446477657666666615551010111541101"
#define AMMOLINE_DEFAULT_DELAY "000000000000020550000004000700400000000022000000060000"
--- a/QTfrontend/hwform.cpp Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/hwform.cpp Sat Sep 24 22:14:10 2011 +0200
@@ -384,7 +384,7 @@
if(teamslist.empty()) {
HWTeam defaultTeam(tr("DefaultTeam"));
- defaultTeam.SaveToFile();
+ defaultTeam.saveToFile();
teamslist.push_back(tr("DefaultTeam"));
}
@@ -491,7 +491,7 @@
QList<HWTeam> teamsList;
for (QStringList::iterator it = tmNames.begin(); it != tmNames.end(); it++) {
HWTeam team(*it);
- team.LoadFromFile();
+ team.loadFromFile();
teamsList.push_back(team);
}
@@ -614,7 +614,7 @@
QStringList tmnames;
foreach(HWTeam team, curTeamSelWidget->getNotPlayingTeams())
- tmnames += team.TeamName;
+ tmnames += team.name();
//UpdateTeamsLists(&tmnames); // FIXME: still need more work if teamname is updated while configuring
UpdateTeamsLists();
@@ -632,7 +632,7 @@
void HWForm::EditTeam()
{
editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
- editedTeam->LoadFromFile();
+ editedTeam->loadFromFile();
editedTeam->SetToPage(this);
GoToPage(ID_PAGE_SETUP_TEAM);
}
@@ -643,7 +643,7 @@
if (reallyDelete.exec() == QMessageBox::Ok) {
editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
- editedTeam->DeleteFile();
+ editedTeam->deleteFile();
// Remove from lists
ui.pageOptions->CBTeamName->removeItem(ui.pageOptions->CBTeamName->currentIndex());
@@ -653,21 +653,21 @@
void HWForm::RandomNames()
{
editedTeam->GetFromPage(this);
- namegen->TeamRandomNames(editedTeam, true);
+ namegen->teamRandomNames(*editedTeam, true);
editedTeam->SetToPage(this);
}
void HWForm::RandomName(const int &i)
{
editedTeam->GetFromPage(this);
- namegen->TeamRandomName(editedTeam,i);
+ namegen->teamRandomName(*editedTeam,i);
editedTeam->SetToPage(this);
}
void HWForm::TeamSave()
{
editedTeam->GetFromPage(this);
- editedTeam->SaveToFile();
+ editedTeam->saveToFile();
delete editedTeam;
editedTeam=0;
UpdateTeamsLists();
@@ -1315,7 +1315,8 @@
tmpdir.setFilter(QDir::Files);
QStringList userentries = tmpdir.entryList(QStringList("*#*.lua"));
//entries.sort();
- for(int i = 0; (i < userentries.count()) && (i <= team.CampaignProgress); i++)
+ unsigned int n = userentries.count();
+ for(unsigned int i = 0; (i < n) && (i <= team.campaignProgress()); i++)
ui.pageCampaign->CBSelect->addItem(QString(userentries[i]).replace(QRegExp("^(\\d+)#(.+)\\.lua"), QComboBox::tr("Mission") + " \\1: \\2").replace("_", " "), QString(userentries[i]).replace(QRegExp("^(.*)\\.lua"), "\\1"));
tmpdir.cd(datadir->absolutePath());
@@ -1323,7 +1324,8 @@
tmpdir.setFilter(QDir::Files);
QStringList entries = tmpdir.entryList(QStringList("*#*.lua"));
//entries.sort();
- for(int i = 0; (i < entries.count()) && (i <= team.CampaignProgress); i++) {
+ n = entries.count();
+ for(unsigned int i = 0; (i < n) && (i <= team.campaignProgress()); i++) {
if (userentries.contains(entries[i])) continue;
ui.pageCampaign->CBSelect->addItem(QString(entries[i]).replace(QRegExp("^(\\d+)#(.+)\\.lua"), QComboBox::tr("Mission") + " \\1: \\2").replace("_", " "), QString(entries[i]).replace(QRegExp("^(.*)\\.lua"), "\\1"));
}
--- a/QTfrontend/namegen.cpp Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/namegen.cpp Sat Sep 24 22:14:10 2011 +0200
@@ -27,10 +27,10 @@
HWNamegen::HWNamegen() :
- TypesAvliable(false)
+ typesAvailable(false)
{
- TypesLoad();
+ loadTypes();
}
HWNamegen::~HWNamegen()
@@ -39,34 +39,36 @@
-void HWNamegen::TeamRandomName(HWTeam*& team, const int HedgehogNumber)
+void HWNamegen::teamRandomName(HWTeam & team, const int HedgehogNumber)
{
- RandomNameByHat(team, HedgehogNumber);
+ randomNameByHat(team, HedgehogNumber);
}
-void HWNamegen::TeamRandomNames(HWTeam*& team, const bool changeteamname)
+void HWNamegen::teamRandomNames(HWTeam & team, const bool changeteamname)
{
- if ((TypesHatnames.size() > 0) && TypesAvliable){
+ if ((TypesHatnames.size() > 0) && typesAvailable){
int kind = (rand()%(TypesHatnames.size()));
if (changeteamname){
if (TypesTeamnames[kind].size() > 0){
- team->TeamName = TypesTeamnames[kind][rand()%(TypesTeamnames[kind].size())];
+ team.setName(TypesTeamnames[kind][rand()%(TypesTeamnames[kind].size())]);
}
- team->Grave = GetRandomGrave();
- team->Fort = GetRandomFort();
- team->Voicepack = "Default";
+ team.setGrave(getRandomGrave());
+ team.setFort(getRandomFort());
+ team.setVoicepack("Default");
}
//give each hedgehog a random name:
//TODO: load the dictionary only once! (right now it's loaded once for each hedgehog)
- for(int i = 0; i < 8; i++)
+ for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
if ((TypesHatnames[kind].size()) > 0){
- team->Hedgehogs[i].Hat = TypesHatnames[kind][rand()%(TypesHatnames[kind].size())];
+ HWHog hh = team.hedgehog(i);
+ hh.Hat = TypesHatnames[kind][rand()%(TypesHatnames[kind].size())];
+ team.setHedgehog(i,hh);
}
- RandomNameByHat(team,i);
+ randomNameByHat(team,i);
}
}
@@ -74,18 +76,20 @@
}
-void HWNamegen::RandomNameByHat(HWTeam*& team, const int HedgehogNumber)
+void HWNamegen::randomNameByHat(HWTeam & team, const int HedgehogNumber)
{
QStringList Dictionaries;
- HatCfgLoad(team->Hedgehogs[HedgehogNumber].Hat,Dictionaries);
+ hatCfgLoad(team.hedgehog(HedgehogNumber).Hat,Dictionaries);
QStringList Dictionary;
- DictLoad(Dictionaries[rand()%(Dictionaries.size())],Dictionary);
+ dictLoad(Dictionaries[rand()%(Dictionaries.size())],Dictionary);
- team->Hedgehogs[HedgehogNumber].Name = Dictionary[rand()%(Dictionary.size())];
+ HWHog hh = team.hedgehog(HedgehogNumber);
+ hh.Name = Dictionary[rand()%(Dictionary.size())];
+ team.setHedgehog(HedgehogNumber, hh);
}
-void HWNamegen::DictLoad(const QString filename, QStringList &list)
+void HWNamegen::dictLoad(const QString filename, QStringList &list)
{
list.clear();
@@ -109,7 +113,7 @@
}
-void HWNamegen::HatCfgLoad(const QString hatname, QStringList &list)
+void HWNamegen::hatCfgLoad(const QString hatname, QStringList &list)
{
list.clear();
@@ -133,13 +137,13 @@
}
-void HWNamegen::TypesLoad()
+void HWNamegen::loadTypes()
{
QFile file;
file.setFileName(QString("%1/Data/Names/types.ini").arg(cfgdir->absolutePath()));
if (!file.exists()) file.setFileName(QString("%1/Names/types.ini").arg(datadir->absolutePath()));
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
- {TypesAvliable = FALSE; return;}
+ {typesAvailable = false; return;}
int counter = 0; //counter starts with 0 (teamnames mode)
TypesTeamnames.append(QStringList());
@@ -155,7 +159,7 @@
TypesHatnames.append(QStringList());
}
} else if ((line == QString("*****")) || (line == QString("*END*"))){
- TypesAvliable = TRUE; return; // bye bye
+ typesAvailable = true; return; // bye bye
} else {
if ((counter%2) == 0){ // even => teamnames mode
TypesTeamnames[(counter/2)].append(line);
@@ -165,13 +169,13 @@
}
// Types.append(line);
}
- TypesAvliable = TRUE;
+ typesAvailable = true;
return;
}
-QString HWNamegen::GetRandomGrave()
+QString HWNamegen::getRandomGrave()
{
QStringList Graves;
@@ -199,7 +203,7 @@
return Graves[rand()%(Graves.size())];
}
-QString HWNamegen::GetRandomFort()
+QString HWNamegen::getRandomFort()
{
QStringList Forts;
--- a/QTfrontend/namegen.h Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/namegen.h Sat Sep 24 22:14:10 2011 +0200
@@ -31,21 +31,21 @@
HWNamegen();
~HWNamegen();
- void TeamRandomName(HWTeam*& team, const int HedgehogNumber);
- void TeamRandomNames(HWTeam*& team, const bool changeteamname);
- void RandomNameByHat(HWTeam*& team, const int HedgehogNumber);
+ void teamRandomName(HWTeam & team, const int HedgehogNumber);
+ void teamRandomNames(HWTeam & team, const bool changeteamname);
+ void randomNameByHat(HWTeam & team, const int HedgehogNumber);
private:
QList<QStringList> TypesTeamnames;
QList<QStringList> TypesHatnames;
- bool TypesAvliable;
- void TypesLoad();
- void DictLoad(const QString filename, QStringList &list);
- void HatCfgLoad(const QString hatname, QStringList &list);
+ bool typesAvailable;
+ void loadTypes();
+ void dictLoad(const QString filename, QStringList &list);
+ void hatCfgLoad(const QString hatname, QStringList &list);
- QString GetRandomGrave();
- QString GetRandomFort();
+ QString getRandomGrave();
+ QString getRandomFort();
};
--- a/QTfrontend/newnetclient.cpp Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/newnetclient.cpp Sat Sep 24 22:14:10 2011 +0200
@@ -104,27 +104,27 @@
void HWNewNet::AddTeam(const HWTeam & team)
{
QString cmd = QString("ADD_TEAM") + delimeter +
- team.TeamName + delimeter +
- team.teamColor.name() + delimeter +
- team.Grave + delimeter +
- team.Fort + delimeter +
- team.Voicepack + delimeter +
- team.Flag + delimeter +
- QString::number(team.difficulty);
+ team.name() + delimeter +
+ team.color().name() + delimeter +
+ team.grave() + delimeter +
+ team.fort() + delimeter +
+ team.voicepack() + delimeter +
+ team.flag() + delimeter +
+ QString::number(team.difficulty());
- for(int i = 0; i < 8; ++i)
+ for(unsigned int i = 0; i < HEDGEHOGS_PER_TEAM; ++i)
{
cmd.append(delimeter);
- cmd.append(team.Hedgehogs[i].Name);
+ cmd.append(team.hedgehog(i).Name);
cmd.append(delimeter);
- cmd.append(team.Hedgehogs[i].Hat);
+ cmd.append(team.hedgehog(i).Hat);
}
RawSendNet(cmd);
}
void HWNewNet::RemoveTeam(const HWTeam & team)
{
- RawSendNet(QString("REMOVE_TEAM") + delimeter + team.TeamName);
+ RawSendNet(QString("REMOVE_TEAM") + delimeter + team.name());
}
void HWNewNet::NewNick(const QString & nick)
@@ -546,7 +546,7 @@
return;
}
HWTeam tmptm(lst[1]);
- tmptm.numHedgehogs = lst[2].toUInt();
+ tmptm.setNumHedgehogs(lst[2].toUInt());
emit hhnumChanged(tmptm);
return;
}
@@ -558,7 +558,7 @@
return;
}
HWTeam tmptm(lst[1]);
- tmptm.teamColor = QColor(lst[2]);
+ tmptm.setColor(QColor(lst[2]));
emit teamColorChanged(tmptm);
return;
}
@@ -618,8 +618,8 @@
if (isChief)
RawSendNet(QString("HH_NUM%1%2%1%3")
.arg(delimeter)
- .arg(team.TeamName)
- .arg(team.numHedgehogs));
+ .arg(team.name())
+ .arg(team.numHedgehogs()));
}
void HWNewNet::onTeamColorChanged(const HWTeam& team)
@@ -627,8 +627,8 @@
if (isChief)
RawSendNet(QString("TEAM_COLOR%1%2%1%3")
.arg(delimeter)
- .arg(team.TeamName)
- .arg(team.teamColor.name()));
+ .arg(team.name())
+ .arg(team.color().name()));
}
void HWNewNet::onParamChanged(const QString & param, const QStringList & value)
--- a/QTfrontend/pagegamestats.cpp Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/pagegamestats.cpp Sat Sep 24 22:14:10 2011 +0200
@@ -183,12 +183,12 @@
//AddStatText("<p>local team: " + info + "</p>");
QStringList infol = info.split(":");
HWTeam team(infol[0]);
- if(team.FileExists()) // do some better test to avoid influence from scripted/predefined teams?
+ if(team.fileExists()) // do some better test to avoid influence from scripted/predefined teams?
{
- team.LoadFromFile();
- team.Rounds++;
+ team.loadFromFile();
+ team.incRounds();
if(infol[1].toInt() > 0) // might require some better test for winning condition (or changed flag) ... WIP!
- team.Wins++; // should draws count as wins?
+ team.incWins(); // should draws count as wins?
//team.SaveToFile(); // don't save yet
}
break;
--- a/QTfrontend/team.cpp Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/team.cpp Sat Sep 24 22:14:10 2011 +0200
@@ -26,111 +26,110 @@
#include "team.h"
#include "hwform.h"
#include "pageeditteam.h"
-#include "hwconsts.h"
#include "hats.h"
HWTeam::HWTeam(const QString & teamname) :
- difficulty(0),
- numHedgehogs(4),
+ m_difficulty(0),
+ m_numHedgehogs(4),
m_isNetTeam(false)
{
- TeamName = teamname;
- OldTeamName = TeamName;
- for (int i = 0; i < 8; i++)
+ m_name = teamname;
+ OldTeamName = m_name;
+ for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
- Hedgehogs[i].Name = (QLineEdit::tr("hedgehog %1").arg(i+1));
- Hedgehogs[i].Hat = "NoHat";
+ m_hedgehogs[i].Name = (QLineEdit::tr("hedgehog %1").arg(i+1));
+ m_hedgehogs[i].Hat = "NoHat";
}
- Grave = "Statue";
- Fort = "Plane";
- Voicepack = "Default";
- Flag = "hedgewars";
+ m_grave = "Statue";
+ m_fort = "Plane";
+ m_voicepack = "Default";
+ m_flag = "hedgewars";
for(int i = 0; i < BINDS_NUMBER; i++)
{
binds[i].action = cbinds[i].action;
binds[i].strbind = cbinds[i].strbind;
}
- Rounds = 0;
- Wins = 0;
- CampaignProgress = 0;
+ m_rounds = 0;
+ m_wins = 0;
+ m_campaignProgress = 0;
}
HWTeam::HWTeam(const QStringList& strLst) :
- numHedgehogs(4),
+ m_numHedgehogs(4),
m_isNetTeam(true)
{
// net teams are configured from QStringList
if(strLst.size() != 23) throw HWTeamConstructException();
- TeamName = strLst[0];
- Grave = strLst[1];
- Fort = strLst[2];
- Voicepack = strLst[3];
- Flag = strLst[4];
- Owner = strLst[5];
- difficulty = strLst[6].toUInt();
- for(int i = 0; i < 8; i++)
+ m_name = strLst[0];
+ m_grave = strLst[1];
+ m_fort = strLst[2];
+ m_voicepack = strLst[3];
+ m_flag = strLst[4];
+ m_owner = strLst[5];
+ m_difficulty = strLst[6].toUInt();
+ for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
- Hedgehogs[i].Name=strLst[i * 2 + 7];
- Hedgehogs[i].Hat=strLst[i * 2 + 8];
+ m_hedgehogs[i].Name=strLst[i * 2 + 7];
+ m_hedgehogs[i].Hat=strLst[i * 2 + 8];
// Somehow claymore managed an empty hat. Until we figure out how, this should avoid a repeat
// Checking net teams is probably pointless, but can't hurt.
- if (Hedgehogs[i].Hat.isEmpty()) Hedgehogs[i].Hat = "NoHat";
+ if (m_hedgehogs[i].Hat.isEmpty()) m_hedgehogs[i].Hat = "NoHat";
}
- Rounds = 0;
- Wins = 0;
- CampaignProgress = 0;
+ m_rounds = 0;
+ m_wins = 0;
+ m_campaignProgress = 0;
}
HWTeam::HWTeam() :
- difficulty(0),
- numHedgehogs(4),
+ m_difficulty(0),
+ m_numHedgehogs(4),
m_isNetTeam(false)
{
- TeamName = QString("Team");
- for (int i = 0; i < 8; i++)
+ m_name = QString("Team");
+ for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
- Hedgehogs[i].Name.sprintf("hedgehog %d", i);
- Hedgehogs[i].Hat = "NoHat";
+ m_hedgehogs[i].Name.sprintf("hedgehog %d", i);
+ m_hedgehogs[i].Hat = "NoHat";
}
- Grave = QString("Simple"); // default
- Fort = QString("Island"); // default
- Voicepack = "Default";
- Flag = "hedgewars";
+ m_grave = QString("Simple"); // default
+ m_fort = QString("Island"); // default
+ m_voicepack = "Default";
+ m_flag = "hedgewars";
for(int i = 0; i < BINDS_NUMBER; i++)
{
binds[i].action = cbinds[i].action;
binds[i].strbind = cbinds[i].strbind;
}
- Rounds = 0;
- Wins = 0;
- CampaignProgress = 0;
+ m_rounds = 0;
+ m_wins = 0;
+ m_campaignProgress = 0;
}
-bool HWTeam::LoadFromFile()
+bool HWTeam::loadFromFile()
{
- QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + TeamName + ".hwt", QSettings::IniFormat, 0);
+ QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt", QSettings::IniFormat, 0);
teamfile.setIniCodec("UTF-8");
- TeamName = teamfile.value("Team/Name", TeamName).toString();
- Grave = teamfile.value("Team/Grave", "Statue").toString();
- Fort = teamfile.value("Team/Fort", "Plane").toString();
- Voicepack = teamfile.value("Team/Voicepack", "Default").toString();
- Flag = teamfile.value("Team/Flag", "hedgewars").toString();
- difficulty = teamfile.value("Team/Difficulty", 0).toInt();
- Rounds = teamfile.value("Team/Rounds", 0).toInt();
- Wins = teamfile.value("Team/Wins", 0).toInt();
- CampaignProgress = teamfile.value("Team/CampaignProgress", 0).toInt();
- for(int i = 0; i < 8; i++)
+ m_name = teamfile.value("Team/Name", m_name).toString();
+ m_grave = teamfile.value("Team/Grave", "Statue").toString();
+ m_fort = teamfile.value("Team/Fort", "Plane").toString();
+ m_voicepack = teamfile.value("Team/Voicepack", "Default").toString();
+ m_flag = teamfile.value("Team/Flag", "hedgewars").toString();
+ m_difficulty = teamfile.value("Team/Difficulty", 0).toInt();
+ m_rounds = teamfile.value("Team/Rounds", 0).toInt();
+ m_wins = teamfile.value("Team/Wins", 0).toInt();
+ m_campaignProgress = teamfile.value("Team/CampaignProgress", 0).toInt();
+ for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
QString hh = QString("Hedgehog%1/").arg(i);
- Hedgehogs[i].Name = teamfile.value(hh + "Name", QString("hedgehog %1").arg(i+1)).toString();
- Hedgehogs[i].Hat = teamfile.value(hh + "Hat", "NoHat").toString();
- Hedgehogs[i].Rounds = teamfile.value(hh + "Rounds", 0).toInt();
- Hedgehogs[i].Kills = teamfile.value(hh + "Kills", 0).toInt();
- Hedgehogs[i].Deaths = teamfile.value(hh + "Deaths", 0).toInt();
- Hedgehogs[i].Suicides = teamfile.value(hh + "Suicides", 0).toInt();
+ m_hedgehogs[i].Name = teamfile.value(hh + "Name", QString("hedgehog %1").arg(i+1)).toString();
+ m_hedgehogs[i].Hat = teamfile.value(hh + "Hat", "NoHat").toString();
+ m_hedgehogs[i].Rounds = teamfile.value(hh + "Rounds", 0).toInt();
+ m_hedgehogs[i].Kills = teamfile.value(hh + "Kills", 0).toInt();
+ m_hedgehogs[i].Deaths = teamfile.value(hh + "Deaths", 0).toInt();
+ m_hedgehogs[i].Suicides = teamfile.value(hh + "Suicides", 0).toInt();
}
for(int i = 0; i < BINDS_NUMBER; i++)
binds[i].strbind = teamfile.value(QString("Binds/%1").arg(binds[i].action), cbinds[i].strbind).toString();
@@ -142,49 +141,49 @@
return true;
}
-bool HWTeam::FileExists()
+bool HWTeam::fileExists()
{
- QFile f(cfgdir->absolutePath() + "/Teams/" + TeamName + ".hwt");
+ QFile f(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt");
return f.exists();
}
-bool HWTeam::DeleteFile()
+bool HWTeam::deleteFile()
{
if(m_isNetTeam)
return false;
- QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + TeamName + ".hwt");
+ QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt");
cfgfile.remove();
return true;
}
-bool HWTeam::SaveToFile()
+bool HWTeam::saveToFile()
{
- if (OldTeamName != TeamName)
+ if (OldTeamName != m_name)
{
QFile cfgfile(cfgdir->absolutePath() + "/Teams/" + OldTeamName + ".hwt");
cfgfile.remove();
- OldTeamName = TeamName;
+ OldTeamName = m_name;
}
- QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + TeamName + ".hwt", QSettings::IniFormat, 0);
+ QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt", QSettings::IniFormat, 0);
teamfile.setIniCodec("UTF-8");
- teamfile.setValue("Team/Name", TeamName);
- teamfile.setValue("Team/Grave", Grave);
- teamfile.setValue("Team/Fort", Fort);
- teamfile.setValue("Team/Voicepack", Voicepack);
- teamfile.setValue("Team/Flag", Flag);
- teamfile.setValue("Team/Difficulty", difficulty);
- teamfile.setValue("Team/Rounds", Rounds);
- teamfile.setValue("Team/Wins", Wins);
- teamfile.setValue("Team/CampaignProgress", CampaignProgress);
- for(int i = 0; i < 8; i++)
+ teamfile.setValue("Team/Name", m_name);
+ teamfile.setValue("Team/Grave", m_grave);
+ teamfile.setValue("Team/Fort", m_fort);
+ teamfile.setValue("Team/Voicepack", m_voicepack);
+ teamfile.setValue("Team/Flag", m_flag);
+ teamfile.setValue("Team/Difficulty", m_difficulty);
+ teamfile.setValue("Team/Rounds", m_rounds);
+ teamfile.setValue("Team/Wins", m_wins);
+ teamfile.setValue("Team/CampaignProgress", m_campaignProgress);
+ for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
QString hh = QString("Hedgehog%1/").arg(i);
- teamfile.setValue(hh + "Name", Hedgehogs[i].Name);
- teamfile.setValue(hh + "Hat", Hedgehogs[i].Hat);
- teamfile.setValue(hh + "Rounds", Hedgehogs[i].Rounds);
- teamfile.setValue(hh + "Kills", Hedgehogs[i].Kills);
- teamfile.setValue(hh + "Deaths", Hedgehogs[i].Deaths);
- teamfile.setValue(hh + "Suicides", Hedgehogs[i].Suicides);
+ teamfile.setValue(hh + "Name", m_hedgehogs[i].Name);
+ teamfile.setValue(hh + "Hat", m_hedgehogs[i].Hat);
+ teamfile.setValue(hh + "Rounds", m_hedgehogs[i].Rounds);
+ teamfile.setValue(hh + "Kills", m_hedgehogs[i].Kills);
+ teamfile.setValue(hh + "Deaths", m_hedgehogs[i].Deaths);
+ teamfile.setValue(hh + "Suicides", m_hedgehogs[i].Suicides);
}
for(int i = 0; i < BINDS_NUMBER; i++)
teamfile.setValue(QString("Binds/%1").arg(binds[i].action), binds[i].strbind);
@@ -198,21 +197,21 @@
void HWTeam::SetToPage(HWForm * hwform)
{
- hwform->ui.pageEditTeam->TeamNameEdit->setText(TeamName);
- hwform->ui.pageEditTeam->CBTeamLvl->setCurrentIndex(difficulty);
- for(int i = 0; i < 8; i++)
+ hwform->ui.pageEditTeam->TeamNameEdit->setText(m_name);
+ hwform->ui.pageEditTeam->CBTeamLvl->setCurrentIndex(m_difficulty);
+ for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
- hwform->ui.pageEditTeam->HHNameEdit[i]->setText(Hedgehogs[i].Name);
- if (Hedgehogs[i].Hat.startsWith("Reserved"))
- hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData("Reserved "+Hedgehogs[i].Hat.remove(0,40), Qt::DisplayRole));
+ hwform->ui.pageEditTeam->HHNameEdit[i]->setText(m_hedgehogs[i].Name);
+ if (m_hedgehogs[i].Hat.startsWith("Reserved"))
+ hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData("Reserved "+m_hedgehogs[i].Hat.remove(0,40), Qt::DisplayRole));
else
- hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData(Hedgehogs[i].Hat, Qt::DisplayRole));
+ hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData(m_hedgehogs[i].Hat, Qt::DisplayRole));
}
- hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(Grave));
- hwform->ui.pageEditTeam->CBFlag->setCurrentIndex(hwform->ui.pageEditTeam->CBFlag->findData(Flag));
+ hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(m_grave));
+ hwform->ui.pageEditTeam->CBFlag->setCurrentIndex(hwform->ui.pageEditTeam->CBFlag->findData(m_flag));
- hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(Fort));
- hwform->ui.pageEditTeam->CBVoicepack->setCurrentIndex(hwform->ui.pageEditTeam->CBVoicepack->findText(Voicepack));
+ hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(m_fort));
+ hwform->ui.pageEditTeam->CBVoicepack->setCurrentIndex(hwform->ui.pageEditTeam->CBVoicepack->findText(m_voicepack));
//hwform->ui.pageEditTeam->CBFort_activated(Fort);
for(int i = 0; i < BINDS_NUMBER; i++)
@@ -223,55 +222,55 @@
void HWTeam::GetFromPage(HWForm * hwform)
{
- TeamName = hwform->ui.pageEditTeam->TeamNameEdit->text();
- difficulty = hwform->ui.pageEditTeam->CBTeamLvl->currentIndex();
- for(int i = 0; i < 8; i++)
+ m_name = hwform->ui.pageEditTeam->TeamNameEdit->text();
+ m_difficulty = hwform->ui.pageEditTeam->CBTeamLvl->currentIndex();
+ for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
- Hedgehogs[i].Name = hwform->ui.pageEditTeam->HHNameEdit[i]->text();
+ m_hedgehogs[i].Name = hwform->ui.pageEditTeam->HHNameEdit[i]->text();
if (hwform->ui.pageEditTeam->HHHats[i]->currentText().startsWith("Reserved"))
- Hedgehogs[i].Hat = "Reserved"+playerHash+hwform->ui.pageEditTeam->HHHats[i]->currentText().remove(0,9);
+ m_hedgehogs[i].Hat = "Reserved"+playerHash+hwform->ui.pageEditTeam->HHHats[i]->currentText().remove(0,9);
else
- Hedgehogs[i].Hat = hwform->ui.pageEditTeam->HHHats[i]->currentText();
+ m_hedgehogs[i].Hat = hwform->ui.pageEditTeam->HHHats[i]->currentText();
}
- Grave = hwform->ui.pageEditTeam->CBGrave->currentText();
- Fort = hwform->ui.pageEditTeam->CBFort->currentText();
- Voicepack = hwform->ui.pageEditTeam->CBVoicepack->currentText();
- Flag = hwform->ui.pageEditTeam->CBFlag->itemData(hwform->ui.pageEditTeam->CBFlag->currentIndex()).toString();
+ m_grave = hwform->ui.pageEditTeam->CBGrave->currentText();
+ m_fort = hwform->ui.pageEditTeam->CBFort->currentText();
+ m_voicepack = hwform->ui.pageEditTeam->CBVoicepack->currentText();
+ m_flag = hwform->ui.pageEditTeam->CBFlag->itemData(hwform->ui.pageEditTeam->CBFlag->currentIndex()).toString();
for(int i = 0; i < BINDS_NUMBER; i++)
{
binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->itemData(hwform->ui.pageEditTeam->CBBind[i]->currentIndex()).toString();
}
}
-QStringList HWTeam::TeamGameConfig(quint32 InitHealth) const
+QStringList HWTeam::teamGameConfig(quint32 InitHealth) const
{
QStringList sl;
if (m_isNetTeam)
{
- sl.push_back(QString("eaddteam %3 %1 %2").arg(teamColor.rgb() & 0xffffff).arg(TeamName).arg(QString(QCryptographicHash::hash(Owner.toLatin1(), QCryptographicHash::Md5).toHex())));
+ sl.push_back(QString("eaddteam %3 %1 %2").arg(m_color.rgb() & 0xffffff).arg(m_name).arg(QString(QCryptographicHash::hash(m_owner.toLatin1(), QCryptographicHash::Md5).toHex())));
sl.push_back("erdriven");
}
- else sl.push_back(QString("eaddteam %3 %1 %2").arg(teamColor.rgb() & 0xffffff).arg(TeamName).arg(playerHash));
+ else sl.push_back(QString("eaddteam %3 %1 %2").arg(m_color.rgb() & 0xffffff).arg(m_name).arg(playerHash));
- sl.push_back(QString("egrave " + Grave));
- sl.push_back(QString("efort " + Fort));
- sl.push_back(QString("evoicepack " + Voicepack));
- sl.push_back(QString("eflag " + Flag));
+ sl.push_back(QString("egrave " + m_grave));
+ sl.push_back(QString("efort " + m_fort));
+ sl.push_back(QString("evoicepack " + m_voicepack));
+ sl.push_back(QString("eflag " + m_flag));
if (!m_isNetTeam)
for(int i = 0; i < BINDS_NUMBER; i++)
if(!binds[i].strbind.isEmpty())
sl.push_back(QString("ebind " + binds[i].strbind + " " + binds[i].action));
- for (int t = 0; t < numHedgehogs; t++)
+ for (int t = 0; t < m_numHedgehogs; t++)
{
sl.push_back(QString("eaddhh %1 %2 %3")
- .arg(QString::number(difficulty),
+ .arg(QString::number(m_difficulty),
QString::number(InitHealth),
- Hedgehogs[t].Name));
+ m_hedgehogs[t].Name));
sl.push_back(QString("ehat %1")
- .arg(Hedgehogs[t].Hat));
+ .arg(m_hedgehogs[t].Hat));
}
return sl;
}
@@ -283,11 +282,67 @@
bool HWTeam::operator==(const HWTeam& t1) const {
- return TeamName==t1.TeamName;
+ return m_name==t1.m_name;
}
bool HWTeam::operator<(const HWTeam& t1) const {
- return TeamName<t1.TeamName; // if names are equal - test if it is net team
+ return m_name<t1.m_name; // if names are equal - test if it is net team
}
+//// Methods for member inspection+modification ////
+
+
+// name
+QString HWTeam::name() const { return m_name; }
+ void HWTeam::setName(const QString & name) { m_name = name; }
+
+// single hedgehog
+const HWHog & HWTeam::hedgehog(unsigned int idx) const { return m_hedgehogs[idx]; }
+ void HWTeam::setHedgehog(unsigned int idx, const HWHog & hh) { m_hedgehogs[idx] = hh; }
+
+// owner
+QString HWTeam::owner() const { return m_owner; }
+
+
+
+// difficulty
+unsigned int HWTeam::difficulty() const { return m_difficulty; }
+ void HWTeam::setDifficulty(unsigned int level) { m_difficulty = level; }
+
+// color
+QColor HWTeam::color() const { return m_color; }
+ void HWTeam::setColor(const QColor & color) { m_color = color; }
+
+
+
+// flag
+void HWTeam::setFlag(const QString & flag) { m_flag = flag; }
+QString HWTeam::flag() const { return m_flag; }
+
+// fort
+void HWTeam::setFort(const QString & fort) { m_fort = fort; }
+QString HWTeam::fort() const { return m_fort; }
+
+// grave
+void HWTeam::setGrave(const QString & grave) { m_grave = grave; }
+QString HWTeam::grave() const { return m_grave; }
+
+// voicepack - getter/setter
+void HWTeam::setVoicepack(const QString & voicepack) { m_voicepack = voicepack; }
+QString HWTeam::voicepack() const { return m_voicepack; }
+
+
+// campaignProgress - getter
+unsigned int HWTeam::campaignProgress() const { return m_campaignProgress; };
+
+// amount of hedgehogs
+unsigned char HWTeam::numHedgehogs() const { return m_numHedgehogs; }
+ void HWTeam::setNumHedgehogs(unsigned char num) { m_numHedgehogs = num; }
+
+
+
+// rounds+wins - incrementors
+void HWTeam::incRounds() { m_rounds++; }
+void HWTeam::incWins() { m_wins++; }
+
--- a/QTfrontend/team.h Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/team.h Sat Sep 24 22:14:10 2011 +0200
@@ -24,6 +24,7 @@
#include <QString>
#include "binds.h"
#include "achievements.h"
+#include "hwconsts.h"
class HWForm;
class GameUIConfig;
@@ -32,6 +33,7 @@
{
};
+// structure for customization and statistics of a single hedgehog
struct HWHog
{
QString Name;
@@ -39,45 +41,90 @@
int Rounds, Kills, Deaths, Suicides;
};
+// class representing a team
class HWTeam
{
public:
+
+ // constructors
HWTeam(const QString & teamname);
HWTeam(const QStringList& strLst);
HWTeam();
- bool isNetTeam() const;
+ // file operations
+ bool loadFromFile();
+ bool deleteFile();
+ bool saveToFile();
+ bool fileExists();
+
+ // attribute getters
+ unsigned int campaignProgress() const;
+ QColor color() const;
+ unsigned int difficulty() const;
+ QString flag() const;
+ QString fort() const;
+ QString grave() const;
+ const HWHog & hedgehog(unsigned int idx) const;
+ bool isNetTeam() const;
+ QString name() const;
+ unsigned char numHedgehogs() const;
+ QString owner() const;
+ QString voicepack() const;
- QString TeamName;
- QString Grave;
- QString Fort;
- QString Flag;
- QString Voicepack;
- QString Owner;
- int Rounds;
- int Wins;
- int CampaignProgress;
- HWHog Hedgehogs[8];
- unsigned int AchievementProgress[MAX_ACHIEVEMENTS];
- unsigned int difficulty;
+ // attribute setters
+ void setColor(const QColor & color);
+ void setDifficulty(unsigned int level);
+ void setFlag(const QString & flag);
+ void setFort(const QString & fort);
+ void setGrave(const QString & grave);
+ void setHedgehog(unsigned int idx, const HWHog & hh);
+ void setName(const QString & name);
+ void setNumHedgehogs(unsigned char num);
+ void setVoicepack(const QString & voicepack);
+
+ // increments for statistical info
+ void incRounds();
+ void incWins();
+
+ // pages... wait... wth is THIS doing in this class? FIXME!!!!
+ void SetToPage(HWForm * hwform);
+ void GetFromPage(HWForm * hwform);
+
+ // convert team info into strings for further computation
+ QStringList teamGameConfig(quint32 InitHealth) const;
+
+ // comparison operators
+ bool operator==(const HWTeam& t1) const;
+ bool operator<(const HWTeam& t1) const;
+
+
+
+ private:
+
+ QString OldTeamName;
+
+ // class members that contain the general team info and settings
+ QString m_name;
+ QString m_grave;
+ QString m_fort;
+ QString m_flag;
+ QString m_voicepack;
+ HWHog m_hedgehogs[HEDGEHOGS_PER_TEAM];
+ unsigned int m_difficulty;
BindAction binds[BINDS_NUMBER];
- unsigned char numHedgehogs;
- QColor teamColor;
+ // class members that contain info for the current game setup
+ unsigned char m_numHedgehogs;
+ QColor m_color;
+ bool m_isNetTeam;
+ QString m_owner;
- bool LoadFromFile();
- bool DeleteFile();
- bool SaveToFile();
- bool FileExists();
- void SetToPage(HWForm * hwform);
- void GetFromPage(HWForm * hwform);
- QStringList TeamGameConfig(quint32 InitHealth) const;
+ // class members that contain statistics, etc.
+ unsigned int m_campaignProgress;
+ unsigned int m_rounds;
+ unsigned int m_wins;
+ unsigned int AchievementProgress[MAX_ACHIEVEMENTS];
- bool operator==(const HWTeam& t1) const;
- bool operator<(const HWTeam& t1) const;
- private:
- bool m_isNetTeam;
- QString OldTeamName;
};
--- a/QTfrontend/teamselect.cpp Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/teamselect.cpp Sat Sep 24 22:14:10 2011 +0200
@@ -66,10 +66,10 @@
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
if(itPlay==curPlayingTeams.end())
{
- qWarning() << QString("hhNumChanged: team '%1' not found").arg(team.TeamName);
+ qWarning() << QString("hhNumChanged: team '%1' not found").arg(team.name());
return;
}
- itPlay->numHedgehogs=team.numHedgehogs;
+ itPlay->setNumHedgehogs(team.numHedgehogs());
emit hhogsNumChanged(team);
}
@@ -78,10 +78,10 @@
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
if(itPlay==curPlayingTeams.end())
{
- qWarning() << QString("proxyTeamColorChanged: team '%1' not found").arg(team.TeamName);
+ qWarning() << QString("proxyTeamColorChanged: team '%1' not found").arg(team.name());
return;
}
- itPlay->teamColor=team.teamColor;
+ itPlay->setColor(team.color());
emit teamColorChanged(team);
}
@@ -90,10 +90,10 @@
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
if(itPlay==curPlayingTeams.end())
{
- qWarning() << QString("changeHHNum: team '%1' not found").arg(team.TeamName);
+ qWarning() << QString("changeHHNum: team '%1' not found").arg(team.name());
return;
}
- itPlay->numHedgehogs=team.numHedgehogs;
+ itPlay->setNumHedgehogs(team.numHedgehogs());
framePlaying->setHHNum(team);
}
@@ -103,10 +103,10 @@
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
if(itPlay==curPlayingTeams.end())
{
- qWarning() << QString("changeTeamColor: team '%1' not found").arg(team.TeamName);
+ qWarning() << QString("changeTeamColor: team '%1' not found").arg(team.name());
return;
}
- itPlay->teamColor=team.teamColor;
+ itPlay->setColor(team.color());
framePlaying->setTeamColor(team);
}
@@ -118,7 +118,7 @@
QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
if(itPlay==curPlayingTeams.end())
{
- qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.TeamName);
+ qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.name());
break;
}
if(itPlay->isNetTeam()) {
@@ -159,7 +159,7 @@
if(framePlaying->isFullTeams()) return;
// dont playing team => playing
team=*itDontPlay; // for net team info saving in framePlaying (we have only name with netID from network)
- itDontPlay->teamColor=framePlaying->getNextColor();
+ itDontPlay->setColor(framePlaying->getNextColor());
curPlayingTeams.push_back(*itDontPlay);
if(!m_acceptOuter) emit teamWillPlay(*itDontPlay);
m_curNotPlayingTeams.erase(itDontPlay);
@@ -276,6 +276,6 @@
void TeamSelWidget::pre_changeTeamStatus(HWTeam team)
{
- team.teamColor=framePlaying->getNextColor();
+ team.setColor(framePlaying->getNextColor());
emit acceptRequested(team);
}
--- a/QTfrontend/teamselhelper.cpp Sat Sep 24 22:27:20 2011 +0400
+++ b/QTfrontend/teamselhelper.cpp Sat Sep 24 22:14:10 2011 +0200
@@ -46,12 +46,12 @@
this->setMaximumHeight(38);
this->setMinimumHeight(38);
QIcon difficultyIcon=team.isNetTeam() ?
- QIcon(QString(":/res/botlevels/net%1.png").arg(m_team.difficulty))
- : QIcon(QString(":/res/botlevels/%1.png").arg(m_team.difficulty));
+ QIcon(QString(":/res/botlevels/net%1.png").arg(m_team.difficulty()))
+ : QIcon(QString(":/res/botlevels/%1.png").arg(m_team.difficulty()));
- butt = new QPushButton(difficultyIcon, team.TeamName.replace("&","&&"), this);
+ butt = new QPushButton(difficultyIcon, team.name().replace("&","&&"), this);
butt->setFlat(true);
- butt->setToolTip(team.Owner);
+ butt->setToolTip(team.owner());
mainLayout.addWidget(butt);
butt->setStyleSheet("QPushButton{"
"icon-size: 48px;"
@@ -76,7 +76,7 @@
phhoger = new CHedgehogerWidget(QImage(":/res/hh25x25.png"), QImage(":/res/hh25x25grey.png"), this);
connect(phhoger, SIGNAL(hedgehogsNumChanged()), this, SLOT(hhNumChanged()));
- phhoger->setHHNum(team.numHedgehogs);
+ phhoger->setHHNum(team.numHedgehogs());
mainLayout.addWidget(phhoger);
} else {
}
@@ -102,7 +102,7 @@
void TeamShowWidget::hhNumChanged()
{
- m_team.numHedgehogs=phhoger->getHedgehogsNum();
+ m_team.setNumHedgehogs(phhoger->getHedgehogsNum());
emit hhNmChanged(m_team);
}
@@ -144,7 +144,7 @@
"border-radius: 2px;"
"}").arg(pOurFrameTeams->currentColor->name()));
- m_team.teamColor=color;
+ m_team.setColor(color);
emit teamColorChanged(m_team);
}