--- a/QTfrontend/team.cpp Fri Aug 29 22:04:50 2008 +0000
+++ b/QTfrontend/team.cpp Sun Aug 31 16:00:31 2008 +0000
@@ -26,7 +26,7 @@
#include "predefteams.h"
#include "pages.h"
#include "hwconsts.h"
-
+#include "hats.h"
HWTeam::HWTeam(const QString & teamname, unsigned int netID) :
difficulty(0),
@@ -35,7 +35,11 @@
{
TeamName = teamname;
OldTeamName = TeamName;
- for (int i = 0; i < 8; i++) HHName[i].sprintf("hedgehog %d", i);
+ for (int i = 0; i < 8; i++)
+ {
+ HHName[i].sprintf("hedgehog %d", i);
+ HHHat[i] = "NoHat";
+ }
Grave = "Simple";
Fort = "Barrelhouse";
for(int i = 0; i < BINDS_NUMBER; i++)
@@ -110,6 +114,14 @@
str.remove(0, 2);
HHName[i] = str;
} else
+ if (str.startsWith("hat"))
+ {
+ str.remove(0, 3);
+ long i = str.left(1).toLong();
+ if ((i < 0) || (i > 7)) continue;
+ str.remove(0, 2);
+ HHHat[i] = str;
+ } else
if (str.startsWith("grave "))
{
str.remove(0, 6);
@@ -159,7 +171,10 @@
stream << "; Generated by Hedgewars, do not modify" << endl;
stream << "name team " << TeamName << endl;
for (int i = 0; i < 8; i++)
+ {
stream << "name hh" << i << " " << HHName[i] << endl;
+ stream << "hat" << i << " " << HHHat[i] << endl;
+ }
stream << "grave " << Grave << endl;
stream << "fort " << Fort << endl;
for(int i = 0; i < BINDS_NUMBER; i++)
@@ -179,6 +194,7 @@
for(int i = 0; i < 8; i++)
{
hwform->ui.pageEditTeam->HHNameEdit[i]->setText(HHName[i]);
+ hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData(HHHat[i], Qt::DisplayRole));
}
hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(Grave));
hwform->ui.pageEditTeam->CBGrave_activated(Grave);
@@ -199,6 +215,7 @@
for(int i = 0; i < 8; i++)
{
HHName[i] = hwform->ui.pageEditTeam->HHNameEdit[i]->text();
+ HHHat[i] = hwform->ui.pageEditTeam->HHHats[i]->currentText();
}
Grave = hwform->ui.pageEditTeam->CBGrave->currentText();