Fix frontend showing 2 errors on engine fatal error (exit code 52)
authorWuzzy <Wuzzy2@mail.ru>
Tue, 17 Jul 2018 20:13:41 +0200
changeset 13505 d9f9e66543d7
parent 13504 c41b16ac2e05
child 13506 bdac56fb6f1a
Fix frontend showing 2 errors on engine fatal error (exit code 52) The exit code checked in the frontend was a hardcoded 2, which was outdated.
QTfrontend/hwconsts.h
QTfrontend/net/tcpBase.cpp
--- a/QTfrontend/hwconsts.h	Tue Jul 17 19:44:29 2018 +0200
+++ b/QTfrontend/hwconsts.h	Tue Jul 17 20:13:41 2018 +0200
@@ -74,6 +74,9 @@
 #define NETGAME_DEFAULT_PORT 46631
 #define HEDGEHOGS_PER_TEAM 8
 
+//Selected engine exit codes, see hedgewars/uConsts.pas
+#define HWENGINE_EXITCODE_OK 0
+#define HWENGINE_EXITCODE_FATAL 52
 
 // see https://en.wikipedia.org/wiki/List_of_colors
 /*define HW_TEAMCOLOR_ARRAY  {0xff007fff, /. azure          ./ \
--- a/QTfrontend/net/tcpBase.cpp	Tue Jul 17 19:44:29 2018 +0200
+++ b/QTfrontend/net/tcpBase.cpp	Tue Jul 17 20:13:41 2018 +0200
@@ -235,7 +235,7 @@
 
     // show error message if there was an error that was not an engine's
     // fatal error - because that one already sent a info via IPC
-    if ((exitCode != 0) && (exitCode != 2))
+    if ((exitCode != HWENGINE_EXITCODE_OK) && (exitCode != HWENGINE_EXITCODE_FATAL))
     {
         // inform user that something bad happened
         MessageDialog::ShowFatalMessage(