Add funny message in stats screen when everyone wins
authorWuzzy <Wuzzy2@mail.ru>
Tue, 11 Sep 2018 16:00:23 +0200
changeset 13773 c084bd440009
parent 13772 2e8b3081cf80
child 13774 e874bfe563c7
Add funny message in stats screen when everyone wins
QTfrontend/hedgewars.qrc
QTfrontend/res/StatsEverAfter.png
QTfrontend/ui/page/pagegamestats.cpp
hedgewars/uIO.pas
hedgewars/uTeams.pas
hedgewars/uTypes.pas
--- a/QTfrontend/hedgewars.qrc	Sun Sep 09 12:25:23 2018 +0200
+++ b/QTfrontend/hedgewars.qrc	Tue Sep 11 16:00:23 2018 +0200
@@ -209,6 +209,7 @@
         <file>res/StatsMostSelfDamage.png</file>
         <file>res/StatsSelfKilled.png</file>
         <file>res/StatsSkipped.png</file>
+        <file>res/StatsEverAfter.png</file>
         <file>res/StatsCustomAchievement.png</file>
         <file>res/Start.png</file>
         <file>res/mapRandom.png</file>
Binary file QTfrontend/res/StatsEverAfter.png has changed
--- a/QTfrontend/ui/page/pagegamestats.cpp	Sun Sep 09 12:25:23 2018 +0200
+++ b/QTfrontend/ui/page/pagegamestats.cpp	Tue Sep 11 16:00:23 2018 +0200
@@ -401,5 +401,11 @@
             scriptPlayerPosition = info.toInt();
             break;
         }
+        case 'h' :
+        {
+            QString message = "<p><img src=\":/res/StatsEverAfter.png\"> " + PageGameStats::tr("With everyone having the same clan color, there was no reason to fight. And so the hedgehogs happily lived in peace ever after.") + "</p>";
+            AddStatText(message);
+            break;
+        }
     }
 }
--- a/hedgewars/uIO.pas	Sun Sep 09 12:25:23 2018 +0200
+++ b/hedgewars/uIO.pas	Tue Sep 11 16:00:23 2018 +0200
@@ -254,7 +254,7 @@
 end;
 
 procedure SendStat(sit: TStatInfoType; s: shortstring);
-const stc: array [TStatInfoType] of char = ('r', 'D', 'k', 'K', 'H', 'T', 'P', 's', 'S', 'B', 'c', 'g', 'p', 'R');
+const stc: array [TStatInfoType] of char = ('r', 'D', 'k', 'K', 'H', 'T', 'P', 's', 'S', 'B', 'c', 'g', 'p', 'R', 'h');
 var buf: shortstring;
 begin
 buf:= 'i' + stc[sit] + s;
--- a/hedgewars/uTeams.pas	Sun Sep 09 12:25:23 2018 +0200
+++ b/hedgewars/uTeams.pas	Tue Sep 11 16:00:23 2018 +0200
@@ -58,6 +58,7 @@
     s, cap: ansistring;
     ts: array[0..(cMaxTeams - 1)] of ansistring;
     t, AliveCount, i, j: LongInt;
+    allWin: boolean;
 begin
 CheckForWin:= false;
 AliveCount:= 0;
@@ -98,6 +99,7 @@
         end
     else // win
         begin
+        allWin:= false;
         with AliveClan^ do
             begin
             if TeamsNumber = 1 then // single team wins
@@ -118,8 +120,11 @@
 
                 // Write victory message for caption and stats page
                 if (TeamsNumber = cMaxTeams) or (TeamsCount = TeamsNumber) then
+                    begin
                     // No enemies for some reason … Everyone wins!!1!
-                    s:= trmsg[sidWinnerAll]
+                    s:= trmsg[sidWinnerAll];
+                    allWin:= true;
+                    end
                 else if (TeamsNumber >= 2) and (TeamsNumber < cMaxTeams) then
                     // List all winning teams in a list
                     s:= FormatA(trmsg[TMsgStrId(Ord(sidWinner2) + (TeamsNumber - 2))], ts);
@@ -144,6 +149,8 @@
 
         if SendGameResultOn then
             SendStat(siGameResult, shortstring(s));
+        if allWin and SendAchievementsStatsOn then
+            SendStat(siEverAfter, '');
         AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
         end;
     SendStats;
--- a/hedgewars/uTypes.pas	Sun Sep 09 12:25:23 2018 +0200
+++ b/hedgewars/uTypes.pas	Tue Sep 11 16:00:23 2018 +0200
@@ -176,7 +176,7 @@
     TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs,
             siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage,
             siMaxTeamKills, siMaxTurnSkips, siCustomAchievement, siGraphTitle,
-            siPointType, siTeamRank);
+            siPointType, siTeamRank, siEverAfter);
 
     // Various 'emote' animations a hedgehog can do
     TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle);
@@ -493,7 +493,7 @@
             sidWinner2, sidWinner3, sidWinner4, sidWinner5, sidWinner6,
             sidWinner7, sidWinnerAll, sidTeamGone, sidTeamBack, sidAutoSkip,
             sidFPS, sidLuaParsingOff, sidLuaParsingOn, sidLuaParsingDenied,
-            sidAmmoCount, sidChat, sidChatTeam, sidChatHog);
+            sidAmmoCount, sidChat, sidChatTeam, sidChatHog, sidEverAfter);
 
     TCmdHelpStrId = (
             sidCmdHeaderBasic, sidCmdTogglechat, sidCmdTeam, sidCmdMe,