Show message when failing to record demo/video due to /lua
authorWuzzy <Wuzzy2@mail.ru>
Fri, 11 Oct 2019 16:54:50 +0200
changeset 15468 a7d54832fad6
parent 15467 e2a23c63efdb
child 15469 25a5a0f86928
Show message when failing to record demo/video due to /lua
QTfrontend/ui/page/pagegamestats.cpp
hedgewars/uTypes.pas
hedgewars/uVideoRec.pas
share/hedgewars/Data/Locale/de.txt
share/hedgewars/Data/Locale/en.txt
--- a/QTfrontend/ui/page/pagegamestats.cpp	Fri Oct 11 16:33:01 2019 +0200
+++ b/QTfrontend/ui/page/pagegamestats.cpp	Fri Oct 11 16:54:50 2019 +0200
@@ -121,7 +121,7 @@
     btnRestart->setFixedHeight(81);
     btnRestart->setStyleSheet("QPushButton{margin-top:24px}");
     btnSave = addButton(":/res/Save.png", bottomLayout, 2, true);
-    btnSave->setWhatsThis(tr("Save"));
+    saveDemoBtnEnabled(true);
     btnSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}");
 
     return bottomLayout;
@@ -174,6 +174,10 @@
 void PageGameStats::saveDemoBtnEnabled(bool enabled)
 {
     btnSave->setEnabled(enabled);
+    if (enabled)
+        btnSave->setWhatsThis(tr("Save demo"));
+    else
+        btnSave->setWhatsThis(tr("Save demo (unavailable because the /lua command was used)"));
 }
 
 void PageGameStats::renderStats()
--- a/hedgewars/uTypes.pas	Fri Oct 11 16:33:01 2019 +0200
+++ b/hedgewars/uTypes.pas	Fri Oct 11 16:54:50 2019 +0200
@@ -515,7 +515,8 @@
             sidWinner2, sidWinner3, sidWinner4, sidWinner5, sidWinner6,
             sidWinner7, sidWinnerAll, sidTeamGone, sidTeamBack, sidAutoSkip,
             sidFPS, sidLuaParsingOff, sidLuaParsingOn, sidLuaParsingDenied,
-            sidAmmoCount, sidChat, sidChatTeam, sidChatHog, sidUnknownGearValue);
+            sidAmmoCount, sidChat, sidChatTeam, sidChatHog, sidUnknownGearValue,
+            sidVideoRecLuaFail);
 
     TCmdHelpStrId = (
             sidCmdHeaderBasic, sidCmdTogglechat, sidCmdTeam, sidCmdMe,
--- a/hedgewars/uVideoRec.pas	Fri Oct 11 16:33:01 2019 +0200
+++ b/hedgewars/uVideoRec.pas	Fri Oct 11 16:54:50 2019 +0200
@@ -48,7 +48,7 @@
 procedure freeModule;
 
 implementation
-uses uVariables, GLunit, SDLh, SysUtils, uUtils, uSound, uIO, uMisc, uTypes, uDebug;
+uses uVariables, GLunit, SDLh, SysUtils, uUtils, uSound, uChat, uIO, uMisc, uTypes, uDebug;
 
 type TAddFileLogRaw = procedure (s: pchar); cdecl;
 const AvwrapperLibName = {$IFDEF WIN32_VCPKG}'avwrapper'{$ELSE}'libavwrapper'{$ENDIF};
@@ -291,6 +291,7 @@
         begin
         // TODO: Show message to player
         PlaySound(sndDenied);
+        AddChatString(#0 + shortstring(trmsg[sidVideoRecLuaFail]));
         AddFileLog('Pre-recording prevented; /lua command was used before');
         exit;
         end;
--- a/share/hedgewars/Data/Locale/de.txt	Fri Oct 11 16:33:01 2019 +0200
+++ b/share/hedgewars/Data/Locale/de.txt	Fri Oct 11 16:54:50 2019 +0200
@@ -111,6 +111,7 @@
 01:46=[Klan] %1: %2
 01:47=[%1]: %2
 01:48=?
+01:49=Videos können nicht aufgenommen werden, nachdem der /lua-Befehl benutzt wurde.
 
 ; Event messages
 ; Hog (%1) died
--- a/share/hedgewars/Data/Locale/en.txt	Fri Oct 11 16:33:01 2019 +0200
+++ b/share/hedgewars/Data/Locale/en.txt	Fri Oct 11 16:54:50 2019 +0200
@@ -121,6 +121,7 @@
 01:47=[%1]: %2
 ; Symbol for unknown mine timer
 01:48=?
+01:49=Videos can't be recorded after the /lua command was used.
 
 ; Event messages
 ; Normal hog (%1) died (0 health)