--- a/QTfrontend/hwform.cpp Tue Dec 27 10:19:21 2005 +0000
+++ b/QTfrontend/hwform.cpp Tue Dec 27 10:20:55 2005 +0000
@@ -134,13 +134,15 @@
if (str.startsWith(";")) continue;
if (str.startsWith("resolution "))
{
- str.remove(0, 11);
- ui.CBResolution->setCurrentIndex(str.toLong());
+ ui.CBResolution->setCurrentIndex(str.mid(11).toLong());
} else
if (str.startsWith("fullscreen "))
{
- str.remove(0, 11);
- ui.CBFullscreen->setChecked(str.toLong());
+ ui.CBFullscreen->setChecked(str.mid(11).toLong());
+ } else
+ if (str.startsWith("nick "))
+ {
+ ui.editNetNick->setText(str.mid(5));
}
}
settings.close();
@@ -156,6 +158,7 @@
connect(ui.BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer()));
connect(ui.BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos()));
connect(ui.BtnNet, SIGNAL(clicked()), this, SLOT(GoToNet()));
+ connect(ui.BtnNetCFGBack, SIGNAL(clicked()), this, SLOT(GoToNetChat()));
connect(ui.BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam()));
connect(ui.BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam()));
connect(ui.BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave()));
@@ -165,6 +168,10 @@
connect(ui.BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo()));
connect(ui.BtnNetConnect, SIGNAL(clicked()), this, SLOT(NetConnect()));
connect(ui.BtnNetChatDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect()));
+ connect(ui.BtnNetChatJoin, SIGNAL(clicked()), this, SLOT(NetJoin()));
+ connect(ui.BtnNetChatCreate, SIGNAL(clicked()), this, SLOT(NetCreate()));
+ connect(ui.BtnNetCFGAddTeam, SIGNAL(clicked()), this, SLOT(NetAddTeam()));
+ connect(ui.BtnNetCFGGo, SIGNAL(clicked()), this, SLOT(NetStartGame()));
connect(ui.CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &)));
connect(ui.CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &)));
ui.Pages->setCurrentIndex(ID_PAGE_MAIN);
@@ -244,9 +251,9 @@
void HWForm::SimpleGame()
{
game = new HWGame(ui.CBResolution->currentIndex(), ui.CBFullscreen->isChecked());
- game->AddTeam(cfgdir.absolutePath() + "/team.cfg");
- game->AddTeam(cfgdir.absolutePath() + "/team.cfg");
- game->Start();
+ game->AddTeam("team.cfg");
+ game->AddTeam("team.cfg");
+ game->StartLocal();
}
void HWForm::CBGrave_activated(const QString & gravename)
@@ -277,6 +284,7 @@
stream << "; Generated by Hedgewars, do not modify" << endl;
stream << "resolution " << ui.CBResolution->currentIndex() << endl;
stream << "fullscreen " << ui.CBFullscreen->isChecked() << endl;
+ stream << "nick " << ui.editNetNick->text() << endl;
settings.close();
}
@@ -297,10 +305,11 @@
void HWForm::NetConnect()
{
- hwnet = new HWNet();
- hwnet->Connect("localhost", 6667);
+ hwnet = new HWNet(ui.CBResolution->currentIndex(), ui.CBFullscreen->isChecked());
+ hwnet->Connect("172.19.5.168", 6667, ui.editNetNick->text());
connect(hwnet, SIGNAL(Connected()), this, SLOT(GoToNetChat()));
connect(hwnet, SIGNAL(AddGame(const QString &)), this, SLOT(AddGame(const QString &)));
+ connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
}
void HWForm::NetDisconnect()
@@ -313,3 +322,31 @@
{
ui.ChannelsList->addItem(chan);
}
+
+void HWForm::NetGameEnter()
+{
+ ui.Pages->setCurrentIndex(ID_PAGE_NETCFG);
+}
+
+void HWForm::NetJoin()
+{
+ hwnet->JoinGame("#hw");
+}
+
+void HWForm::NetCreate()
+{
+ hwnet->JoinGame("#hw");
+}
+
+void HWForm::NetAddTeam()
+{
+ HWTeam team("team");
+ team.SetCfgDir(cfgdir.absolutePath());
+ team.LoadFromFile();
+ hwnet->AddTeam(team);
+}
+
+void HWForm::NetStartGame()
+{
+ hwnet->StartGame();
+}