- Use right packet length
authorunc0rr
Mon, 14 Aug 2006 14:49:40 +0000
changeset 110 330a2dbacd67
parent 109 ab0340f580c2
child 111 30ca06092a64
- Use right packet length - Show messagebox when failed to run engine
QTfrontend/game.cpp
QTfrontend/game.h
hedgewars/CCHandlers.inc
hedgewars/uWorld.pas
--- a/QTfrontend/game.cpp	Sat Aug 12 17:41:02 2006 +0000
+++ b/QTfrontend/game.cpp	Mon Aug 14 14:49:40 2006 +0000
@@ -231,6 +231,7 @@
 	QProcess * process;
 	QStringList arguments;
 	process = new QProcess;
+	connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(StartProcessError(QProcess::ProcessError)));
 	arguments << resolutions[0][config->vid_Resolution()];
 	arguments << resolutions[1][config->vid_Resolution()];
 	arguments << "16";
@@ -241,6 +242,13 @@
 	process->start(bindir->absolutePath() + "/hwengine", arguments);
 }
 
+void HWGame::StartProcessError(QProcess::ProcessError error)
+{
+	QMessageBox::critical(0, tr("Error"),
+				tr("Unable to run engine: %1 (")
+				.arg(error) + bindir->absolutePath() + "/hwengine)");
+}
+
 void HWGame::AddTeam(const QString & teamname)
 {
 	if (TeamCount == 5) return;
--- a/QTfrontend/game.h	Sat Aug 12 17:41:02 2006 +0000
+++ b/QTfrontend/game.h	Mon Aug 14 14:49:40 2006 +0000
@@ -40,6 +40,7 @@
 #include <QByteArray>
 #include <QString>
 #include <QDir>
+#include <QProcess>
 #include "team.h"
 #include "rndstr.h"
 
@@ -104,6 +105,7 @@
 	void NewConnection();
 	void ClientDisconnect();
 	void ClientRead();
+	void StartProcessError(QProcess::ProcessError error);
 };
 
 #endif
--- a/hedgewars/CCHandlers.inc	Sat Aug 12 17:41:02 2006 +0000
+++ b/hedgewars/CCHandlers.inc	Mon Aug 14 14:49:40 2006 +0000
@@ -317,7 +317,7 @@
            SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y);
            dec(TargetPoint.X, WorldDx);
            dec(TargetPoint.Y, WorldDy);
-           s[0]:= #9;
+           s[0]:= #5;
            s[1]:= 'p';
            PSmallInt(@s[2])^:= TargetPoint.X;
            PSmallInt(@s[4])^:= TargetPoint.Y;
--- a/hedgewars/uWorld.pas	Sat Aug 12 17:41:02 2006 +0000
+++ b/hedgewars/uWorld.pas	Mon Aug 14 14:49:40 2006 +0000
@@ -366,7 +366,7 @@
    begin
    if (not CurrentTeam.ExtDriven)and(GameTicks >= PrevSentPointTime + cSendCursorPosTime) then
       begin
-      s[0]:= #9;
+      s[0]:= #5;
       s[1]:= 'P';
       PSmallInt(@s[2])^:= CursorPoint.X - WorldDx;
       PSmallInt(@s[4])^:= CursorPoint.Y - WorldDy;