Fix handling '/skip' command during net game
authorunc0rr
Thu, 08 May 2008 20:30:34 +0000
changeset 917 e59614bffc3f
parent 916 1d0022336fbb
child 918 c8cff180da57
Fix handling '/skip' command during net game
hedgewars/CCHandlers.inc
hedgewars/uConsole.pas
hedgewars/uGame.pas
hedgewars/uGears.pas
--- a/hedgewars/CCHandlers.inc	Thu May 08 18:38:52 2008 +0000
+++ b/hedgewars/CCHandlers.inc	Thu May 08 20:30:34 2008 +0000
@@ -371,7 +371,7 @@
 begin
 if not CurrentTeam^.ExtDriven then SendIPC(',');
 uStats.Skipped;
-TurnTimeLeft:= 0
+skipFlag:= true
 end;
 
 procedure chSetMap(var s: shortstring);
--- a/hedgewars/uConsole.pas	Thu May 08 18:38:52 2008 +0000
+++ b/hedgewars/uConsole.pas	Thu May 08 20:30:34 2008 +0000
@@ -36,7 +36,7 @@
 implementation
 {$J+}
 uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, uLand,
-     uRandom, uAmmos, uTriggers, GL, uStats;
+     uRandom, uAmmos, uTriggers, GL, uStats, uGame;
 const cLineWidth: LongInt = 0;
       cLinesCount = 256;
 
--- a/hedgewars/uGame.pas	Thu May 08 18:38:52 2008 +0000
+++ b/hedgewars/uGame.pas	Thu May 08 20:30:34 2008 +0000
@@ -23,6 +23,8 @@
 
 procedure DoGameTick(Lag: LongInt);
 
+var skipFlag: boolean = false;
+
 ////////////////////
    implementation
 ////////////////////
@@ -51,6 +53,7 @@
 i:= 1;
 while (GameState <> gsExit) and (i <= Lag) do
     begin
+    skipFlag:= false;
     if not CurrentTeam^.ExtDriven then
        begin
        if CurrentHedgehog^.BotLevel <> 0 then ProcessBot;
@@ -75,6 +78,7 @@
                end
           else ProcessGears
        end;
+    if skipFlag then TurnTimeLeft:= 0;
     inc(i)
     end
 end;
--- a/hedgewars/uGears.pas	Thu May 08 18:38:52 2008 +0000
+++ b/hedgewars/uGears.pas	Thu May 08 20:30:34 2008 +0000
@@ -451,11 +451,11 @@
 				end;
 
 if (not CurrentTeam^.ExtDriven) and
-   ((GameTicks and $FFFF) = $FFFF) then
-   begin
-   SendIPCTimeInc;
-   inc(hiTicks) // we do not recieve a message for this
-   end;
+	((GameTicks and $FFFF) = $FFFF) then
+	begin
+	SendIPCTimeInc;
+	inc(hiTicks) // we do not recieve a message for this
+	end;
 
 inc(GameTicks)
 end;