# HG changeset patch
# User unc0rr
# Date 1136838554 0
# Node ID 5d7a505875cd0eac39a8cd8b248430172b3f3730
# Parent 416d54ce0c340bbe5dd86dd504542266a0441b9e
- Fixed crash in IPC code
- Fix exec engine by frontend
diff -r 416d54ce0c34 -r 5d7a505875cd QTfrontend/game.cpp
--- a/QTfrontend/game.cpp Sat Jan 07 15:23:45 2006 +0000
+++ b/QTfrontend/game.cpp Mon Jan 09 20:29:14 2006 +0000
@@ -45,15 +45,6 @@
{
vid_Resolution = Resolution;
vid_Fullscreen = Fullscreen;
- IPCServer.setMaxPendingConnections(1);
- if (!IPCServer.listen(QHostAddress::LocalHost, IPC_PORT))
- {
- QMessageBox::critical(0, tr("Error"),
- tr("Unable to start the server: %1.")
- .arg(IPCServer.errorString()));
- }
- connect(&IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
- IPCSocket = 0;
TeamCount = 0;
seed = "";
cfgdir.setPath(cfgdir.homePath());
@@ -62,9 +53,10 @@
void HWGame::NewConnection()
{
- QTcpSocket * client = IPCServer.nextPendingConnection();
+ QTcpSocket * client = IPCServer->nextPendingConnection();
if(!IPCSocket)
{
+ IPCServer->close();
IPCSocket = client;
connect(client, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
connect(client, SIGNAL(readyRead()), this, SLOT(ClientRead()));
@@ -73,16 +65,17 @@
SENDIPC("?");
} else
{
+ qWarning("2nd IPC client?!");
client->disconnectFromHost();
- delete client;
}
}
void HWGame::ClientDisconnect()
{
+ SaveDemo("demo.hwd_1");
+ IPCSocket->deleteLater();
IPCSocket = 0;
- SaveDemo("demo.hwd_1");
- delete this;
+ deleteLater();
}
void HWGame::SendTeamConfig(int index)
@@ -218,6 +211,17 @@
void HWGame::Start()
{
+ IPCServer = new QTcpServer(this);
+ connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
+ IPCServer->setMaxPendingConnections(1);
+ IPCSocket = 0;
+ if (!IPCServer->listen(QHostAddress::LocalHost, IPC_PORT))
+ {
+ QMessageBox::critical(0, tr("Error"),
+ tr("Unable to start the server: %1.")
+ .arg(IPCServer->errorString()));
+ }
+
QProcess * process;
QStringList arguments;
process = new QProcess;
@@ -227,7 +231,7 @@
arguments << "46631";
arguments << seed;
arguments << (vid_Fullscreen ? "1" : "0");
- process->start("hw", arguments);
+ process->start("./hw", arguments);
}
void HWGame::AddTeam(const QString & teamname)
@@ -265,7 +269,7 @@
quint32 k = 0;
for (int i = 0; i < seed.length(); i++)
{
- k += seed[i].unicode();
+ k += seed[i].cell();
}
return themes[k % len];
}
diff -r 416d54ce0c34 -r 5d7a505875cd QTfrontend/game.h
--- a/QTfrontend/game.h Sat Jan 07 15:23:45 2006 +0000
+++ b/QTfrontend/game.h Mon Jan 09 20:29:14 2006 +0000
@@ -70,7 +70,7 @@
gtDemo = 2,
gtNet = 3
};
- QTcpServer IPCServer;
+ QTcpServer * IPCServer;
QTcpSocket * IPCSocket;
char msgbuf[MAXMSGCHARS];
quint8 msgbufsize;
diff -r 416d54ce0c34 -r 5d7a505875cd QTfrontend/hwform.cpp
--- a/QTfrontend/hwform.cpp Sat Jan 07 15:23:45 2006 +0000
+++ b/QTfrontend/hwform.cpp Mon Jan 09 20:29:14 2006 +0000
@@ -70,11 +70,11 @@
for(quint8 i = 0; i < BINDS_NUMBER; i++)
{
LBind[i] = new QLabel(ui.BindsBox->widget(widind));
- LBind[i]->setGeometry(QRect(10, top + 3, 60, 20));
+ LBind[i]->setGeometry(QRect(10, top + 3, 70, 20));
LBind[i]->setText(cbinds[i].name);
LBind[i]->setAlignment(Qt::AlignRight);
CBBind[i] = new QComboBox(ui.BindsBox->widget(widind));
- CBBind[i]->setGeometry(QRect(80, top, 80, 20));
+ CBBind[i]->setGeometry(QRect(90, top, 80, 20));
CBBind[i]->addItems(binds);
if (cbinds[i].chwidget)
{
@@ -82,7 +82,7 @@
widind++;
} else
{
- top += 30;
+ top += 28;
}
}
diff -r 416d54ce0c34 -r 5d7a505875cd QTfrontend/hwform.ui
--- a/QTfrontend/hwform.ui Sat Jan 07 15:23:45 2006 +0000
+++ b/QTfrontend/hwform.ui Mon Jan 09 20:29:14 2006 +0000
@@ -50,7 +50,7 @@
- 8
+ 1
@@ -141,119 +141,6 @@
Team
-
-
-
- 20
- 340
- 161
- 51
-
-
-
- Player
-
-
-
-
- 10
- 20
- 141
- 22
-
-
- -
-
- Human
-
-
- -
-
- CPU level 1
-
-
- -
-
- CPU level 2
-
-
- -
-
- CPU level 3
-
-
- -
-
- CPU level 4
-
-
- -
-
- CPU level 5
-
-
-
-
-
-
-
- 440
- 400
- 161
- 41
-
-
-
-
- MS Shell Dlg
- 14
- 50
- false
- false
- false
- false
-
-
-
- Discard
-
-
- false
-
-
- false
-
-
-
-
-
- 440
- 340
- 161
- 41
-
-
-
-
- MS Shell Dlg
- 14
- 50
- false
- false
- false
- false
-
-
-
- Save
-
-
- false
-
-
- false
-
-
@@ -353,7 +240,7 @@
200
10
201
- 381
+ 431
@@ -365,7 +252,7 @@
10
20
181
- 351
+ 401
@@ -379,8 +266,8 @@
0
0
- 163
- 221
+ 181
+ 289
@@ -402,8 +289,8 @@
0
0
- 163
- 221
+ 99
+ 29
@@ -412,6 +299,66 @@
+
+
+
+ 440
+ 380
+ 161
+ 41
+
+
+
+
+ MS Shell Dlg
+ 14
+ 50
+ false
+ false
+ false
+ false
+
+
+
+ Discard
+
+
+ false
+
+
+ false
+
+
+
+
+
+ 20
+ 380
+ 161
+ 41
+
+
+
+
+ MS Shell Dlg
+ 14
+ 50
+ false
+ false
+ false
+ false
+
+
+
+ Save
+
+
+ false
+
+
+ false
+
+
@@ -541,66 +488,6 @@
Fullscreen
-
-
-
- 420
- 380
- 161
- 41
-
-
-
-
- MS Shell Dlg
- 14
- 50
- false
- false
- false
- false
-
-
-
- Back
-
-
- false
-
-
- false
-
-
-
-
-
- 30
- 380
- 161
- 41
-
-
-
-
- MS Shell Dlg
- 14
- 50
- false
- false
- false
- false
-
-
-
- Save
-
-
- false
-
-
- false
-
-
@@ -630,6 +517,66 @@
30
+
+
+
+ 20
+ 380
+ 161
+ 41
+
+
+
+
+ MS Shell Dlg
+ 14
+ 50
+ false
+ false
+ false
+ false
+
+
+
+ Save
+
+
+ false
+
+
+ false
+
+
+
+
+
+ 440
+ 380
+ 161
+ 41
+
+
+
+
+ MS Shell Dlg
+ 14
+ 50
+ false
+ false
+ false
+ false
+
+
+
+ Back
+
+
+ false
+
+
+ false
+
+