Fix bugs when entering speech bubble commands during hog placement phase
authorWuzzy <Wuzzy2@mail.ru>
Tue, 09 Apr 2019 00:45:14 +0200
changeset 14799 bbec6b28d072
parent 14798 8015a6e4ca3c
child 14800 f43ab2bd76ae
Fix bugs when entering speech bubble commands during hog placement phase
ChangeLog.txt
hedgewars/uChat.pas
hedgewars/uGears.pas
hedgewars/uGearsRender.pas
--- a/ChangeLog.txt	Tue Apr 09 00:06:53 2019 +0300
+++ b/ChangeLog.txt	Tue Apr 09 00:45:14 2019 +0200
@@ -79,6 +79,7 @@
  * Fix airplane line being drawn above many HUD elements
  * Suppress “<team> is gone.” message at end of game
  * Fix game engine ignoring appropriate number formatting of user language
+ * Fix buggy behaviour when entering speech bubble command in hog placement phase
 
 Frontend:
  + Restructure credits
--- a/hedgewars/uChat.pas	Tue Apr 09 00:06:53 2019 +0300
+++ b/hedgewars/uChat.pas	Tue Apr 09 00:45:14 2019 +0200
@@ -366,7 +366,7 @@
             // default to current hedgehog (if own) or first hedgehog
             if SpeechHogNumber = 0 then
                 begin
-                if not CurrentTeam^.ExtDriven then
+                if (not CurrentTeam^.ExtDriven) and (not CurrentHedgehog^.Unplaced) then
                     SpeechHogNumber:= CurrentTeam^.CurrHedgehog + 1
                 else
                     SpeechHogNumber:= 1;
--- a/hedgewars/uGears.pas	Tue Apr 09 00:06:53 2019 +0300
+++ b/hedgewars/uGears.pas	Tue Apr 09 00:45:14 2019 +0200
@@ -1308,7 +1308,7 @@
     if (x < 4) and (TeamsArray[t] <> nil) then
         begin
             // if team matches current hedgehog team, default to current hedgehog
-            if (i = 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.Team = TeamsArray[t]) then
+            if (i = 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.Team = TeamsArray[t]) and (not CurrentHedgehog^.Unplaced) then
                 hh:= CurrentHedgehog
             else
                 begin
@@ -1317,7 +1317,7 @@
                 c:= 0;
                 while (j <= cMaxHHIndex) and (hh = nil) do
                     begin
-                    if (TeamsArray[t]^.Hedgehogs[j].Gear <> nil) then
+                    if (TeamsArray[t]^.Hedgehogs[j].Gear <> nil) and (not TeamsArray[t]^.Hedgehogs[j].Unplaced) then
                         begin
                         inc(c);
                         if (i=0) or (i=c) then
--- a/hedgewars/uGearsRender.pas	Tue Apr 09 00:06:53 2019 +0300
+++ b/hedgewars/uGearsRender.pas	Tue Apr 09 00:45:14 2019 +0200
@@ -241,7 +241,7 @@
         repeat
         hh:= @TeamsArray[t]^.Hedgehogs[i];
         inc(i);
-        if (hh <> nil) and (hh^.Gear <> nil) then
+        if (hh <> nil) and (hh^.Gear <> nil) and (not hh^.Unplaced) then
             begin
             inc(c);
             HHGear:= hh^.Gear;