Make frontend forward server error and warning messages to engine
authorWuzzy <Wuzzy2@mail.ru>
Wed, 03 Oct 2018 02:28:39 +0200
changeset 13823 d012948b1eda
parent 13822 b56639b52e59
child 13824 93aa09004d36
Make frontend forward server error and warning messages to engine
QTfrontend/game.cpp
QTfrontend/game.h
QTfrontend/hwform.cpp
--- a/QTfrontend/game.cpp	Tue Oct 02 22:11:15 2018 +0200
+++ b/QTfrontend/game.cpp	Wed Oct 03 02:28:39 2018 +0200
@@ -346,6 +346,20 @@
     RawSendIPC(buf);
 }
 
+void HWGame::FromNetWarning(const QString & msg)
+{
+    QByteArray buf;
+    HWProto::addStringToBuffer(buf, "s\x00" + msg + "\x20\x20");
+    RawSendIPC(buf);
+}
+
+void HWGame::FromNetError(const QString & msg)
+{
+    QByteArray buf;
+    HWProto::addStringToBuffer(buf, "s\x05" + msg + "\x20\x20");
+    RawSendIPC(buf);
+}
+
 void HWGame::onClientRead()
 {
     quint8 msglen;
--- a/QTfrontend/game.h	Tue Oct 02 22:11:15 2018 +0200
+++ b/QTfrontend/game.h	Wed Oct 03 02:28:39 2018 +0200
@@ -105,6 +105,8 @@
     public slots:
         void FromNet(const QByteArray & msg);
         void FromNetChat(const QString & msg);
+        void FromNetWarning(const QString & msg);
+        void FromNetError(const QString & msg);
 
     private:
         char msgbuf[MAXMSGCHARS];
--- a/QTfrontend/hwform.cpp	Tue Oct 02 22:11:15 2018 +0200
+++ b/QTfrontend/hwform.cpp	Wed Oct 03 02:28:39 2018 +0200
@@ -1873,6 +1873,8 @@
     connect(game, SIGNAL(SendConsoleCommand(const QString&)), hwnet, SLOT(consoleCommand(const QString&)));
     connect(game, SIGNAL(SendTeamMessage(const QString &)), hwnet, SLOT(SendTeamMessage(const QString &)));
     connect(hwnet, SIGNAL(chatStringFromNet(const QString &)), game, SLOT(FromNetChat(const QString &)), Qt::QueuedConnection);
+    connect(hwnet, SIGNAL(Warning(const QString&)), game, SLOT(FromNetWarning(const QString&)), Qt::QueuedConnection);
+    connect(hwnet, SIGNAL(Error(const QString&)), game, SLOT(FromNetError(const QString&)), Qt::QueuedConnection);
 
     game->StartNet();
 }