--- a/QTfrontend/game.cpp Thu Sep 06 19:10:03 2007 +0000
+++ b/QTfrontend/game.cpp Sat Sep 08 12:12:23 2007 +0000
@@ -115,6 +115,31 @@
team2.TeamGameConfig(gamecfg->getInitHealth())));
}
+void HWGame::SendTrainingConfig()
+{
+ QByteArray teamscfg;
+ HWProto::addStringToBuffer(teamscfg, "TL");
+ HWProto::addStringToBuffer(teamscfg, "eseed none");
+ HWProto::addStringToBuffer(teamscfg, "e$gmflags 0");
+ HWProto::addStringToBuffer(teamscfg, "e$turntime 60000");
+ HWProto::addStringToBuffer(teamscfg, "emap mushrooms");
+ HWProto::addStringToBuffer(teamscfg, "etheme avematan");
+
+ HWTeam team1(0);
+ team1.difficulty = 0;
+ team1.teamColor = QColor(65535);
+ team1.numHedgehogs = 4;
+ HWProto::addStringListToBuffer(teamscfg,
+ team1.TeamGameConfig(100));
+
+ HWTeam team2(2);
+ team2.difficulty = 4;
+ team2.teamColor = QColor(16776960);
+ team2.numHedgehogs = 4;
+ RawSendIPC(HWProto::addStringListToBuffer(teamscfg,
+ team2.TeamGameConfig(100)));
+}
+
void HWGame::SendNetConfig()
{
commonConfig();
@@ -142,6 +167,10 @@
SendNetConfig();
break;
}
+ case gtTraining: {
+ SendTrainingConfig();
+ break;
+ }
}
break;
}
@@ -282,7 +311,11 @@
void HWGame::StartTraining()
{
-
+ gameType = gtTraining;
+ seed = "training";
+ demo.clear();
+ Start();
+ SetGameState(gsStarted);
}
void HWGame::SetGameState(GameState state)
--- a/QTfrontend/game.h Thu Sep 06 19:10:03 2007 +0000
+++ b/QTfrontend/game.h Sat Sep 08 12:12:23 2007 +0000
@@ -67,10 +67,11 @@
private:
enum GameType {
- gtLocal = 1,
- gtQLocal = 2,
- gtDemo = 3,
- gtNet = 4
+ gtLocal = 1,
+ gtQLocal = 2,
+ gtDemo = 3,
+ gtNet = 4,
+ gtTraining = 5
};
char msgbuf[MAXMSGCHARS];
QString teams[5];
@@ -86,6 +87,7 @@
void SendConfig();
void SendQuickConfig();
void SendNetConfig();
+ void SendTrainingConfig();
void ParseMessage(const QByteArray & msg);
void SetGameState(GameState state);
};
--- a/QTfrontend/pages.cpp Thu Sep 06 19:10:03 2007 +0000
+++ b/QTfrontend/pages.cpp Sat Sep 08 12:12:23 2007 +0000
@@ -150,7 +150,7 @@
pageLayout->addWidget(GBoxTeam, 0, 0);
- GBoxHedgehogs = new QGroupBox(this);
+ GBoxHedgehogs = new QGroupBox(this);
GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members"));
GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs);
@@ -168,7 +168,7 @@
BtnTeamDiscard->setText(QPushButton::tr("Discard"));
pageLayout->addWidget(BtnTeamDiscard, 4, 0);
- GBoxBinds = new QGroupBox(this);
+ GBoxBinds = new QGroupBox(this);
GBoxBinds->setTitle(QGroupBox::tr("Key binds"));
QGridLayout * GBBLayout = new QGridLayout(GBoxBinds);
BindsBox = new QToolBox(GBoxBinds);
@@ -208,7 +208,7 @@
widind++;
}
- GBoxGrave = new QGroupBox(this);
+ GBoxGrave = new QGroupBox(this);
GBoxGrave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
GBoxGrave->setTitle(QGroupBox::tr("Grave"));
QGridLayout * GBGLayout = new QGridLayout(GBoxGrave);
@@ -245,13 +245,13 @@
CBFort = new QComboBox(GBoxFort);
CBFort->setMaxCount(65535);
GBFLayout->addWidget(CBFort, 0, 0);
- FortPreview = new SquareLabel(GBoxFort);
+ FortPreview = new SquareLabel(GBoxFort);
FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
FortPreview->setPixmap(QPixmap());
GBFLayout->addWidget(FortPreview, 1, 0);
pageLayout->addWidget(GBoxFort, 2, 2, 1, 2);
- BtnTeamSave = new QPushButton(this);
+ BtnTeamSave = new QPushButton(this);
BtnTeamSave->setFont(*font14);
BtnTeamSave->setText(QPushButton::tr("Save"));
pageLayout->addWidget(BtnTeamSave, 4, 2, 1, 2);
@@ -539,21 +539,23 @@
pageLayout->setColumnStretch(0, 1);
pageLayout->setColumnStretch(1, 2);
pageLayout->setColumnStretch(2, 1);
+ pageLayout->setRowStretch(0, 1);
+ pageLayout->setRowStretch(3, 1);
BtnSimpleGamePage = new QPushButton(this);
BtnSimpleGamePage->setFont(*font14);
BtnSimpleGamePage->setText(QPushButton::tr("Simple Game"));
- pageLayout->addWidget(BtnSimpleGamePage, 0, 1);
+ pageLayout->addWidget(BtnSimpleGamePage, 1, 1);
BtnTrainPage = new QPushButton(this);
BtnTrainPage->setFont(*font14);
BtnTrainPage->setText(QPushButton::tr("Training"));
- pageLayout->addWidget(BtnTrainPage, 1, 1);
+ pageLayout->addWidget(BtnTrainPage, 2, 1);
BtnBack = new QPushButton(this);
BtnBack->setFont(*font14);
BtnBack->setText(QPushButton::tr("Back"));
- pageLayout->addWidget(BtnBack, 3, 1);
+ pageLayout->addWidget(BtnBack, 4, 0);
}