- Fix network (my crappy fault, triggered by nemo's patch)
authorunc0rr
Mon, 11 May 2009 21:19:47 +0000
changeset 2045 b0588498bc3a
parent 2044 8548f5be2d72
child 2046 57fb5673ff17
- Fix network (my crappy fault, triggered by nemo's patch) - Do some good things for engine
hedgewars/CCHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uGears.pas
hedgewars/uVisualGears.pas
--- a/hedgewars/CCHandlers.inc	Mon May 11 19:42:29 2009 +0000
+++ b/hedgewars/CCHandlers.inc	Mon May 11 21:19:47 2009 +0000
@@ -313,12 +313,11 @@
 
 procedure chNextTurn(var s: shortstring);
 begin
-if AllInactive then
-   begin
-   if not CurrentTeam^.ExtDriven then SendIPC('N');
-   TickTrigger(trigTurns);
-   {$IFDEF DEBUGFILE}AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));{$ENDIF}
-   end
+TryDo(AllInactive, '/nextturn called when not all gears are inactive', true);
+if CurrentTeam^.ExtDriven then addfilelog('CurrentTeam^.ExtDriven') else addfilelog('not CurrentTeam^.ExtDriven');
+if not CurrentTeam^.ExtDriven then SendIPC('N');
+TickTrigger(trigTurns);
+{$IFDEF DEBUGFILE}AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));{$ENDIF}
 end;
 
 procedure chSay(var s: shortstring);
--- a/hedgewars/HHHandlers.inc	Mon May 11 19:42:29 2009 +0000
+++ b/hedgewars/HHHandlers.inc	Mon May 11 21:19:47 2009 +0000
@@ -198,7 +198,7 @@
             begin
             tmpGear:= AddVisualGear(0, 0, vgtSpeechBubble);
             tmpGear^.Text:= SpeechText;
-            tmpGear^.Hedgehog:= CurrentHedgehog;
+            tmpGear^.Hedgehog:= Gear^.Hedgehog;
             tmpGear^.FrameTicks:= SpeechType;
             SpeechText:= ''
             end;
--- a/hedgewars/uGears.pas	Mon May 11 19:42:29 2009 +0000
+++ b/hedgewars/uGears.pas	Mon May 11 21:19:47 2009 +0000
@@ -591,7 +591,7 @@
 			ParseCommand('/nextturn', true);
 			SwitchHedgehog;
 
-			inc(step);
+			inc(step); // FIXME wtf is that, it overflows step, and does nothing
 
 			AfterSwitchHedgehog;
 			bBetweenTurns:= false
@@ -649,12 +649,18 @@
           for i:= 0 to cMaxHHIndex do
               with Hedgehogs[i] do
                   begin
-                  if (SpeechGear <> nil) then DeleteVisualGear(SpeechGear);  // remove to restore persisting beyond end of turn. Tiy says was too much of a gameplay issue
+                  if (SpeechGear <> nil) then
+                     begin
+                     DeleteVisualGear(SpeechGear);  // remove to restore persisting beyond end of turn. Tiy says was too much of a gameplay issue
+                     SpeechGear:= nil
+                     end;
+
                   if (Gear <> nil) then
                      if (GameFlags and gfInvulnerable) = 0 then
                         Gear^.Invulnerable:= false;
                   end;
 end;
+
 procedure ApplyDamage(Gear: PGear; Damage: Longword);
 var s: shortstring;
     vampDmg: Longword;
--- a/hedgewars/uVisualGears.pas	Mon May 11 19:42:29 2009 +0000
+++ b/hedgewars/uVisualGears.pas	Mon May 11 21:19:47 2009 +0000
@@ -26,7 +26,6 @@
 {$ENDIF}
 	uFloat;
 {$INCLUDE options.inc}
-const AllInactive: boolean = false;
 
 type PVisualGear = ^TVisualGear;
 	TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword);
@@ -254,15 +253,15 @@
 
 if Gear^.Timer = 0 then
 	begin
-	CurrentHedgehog^.SpeechGear:= nil;
+	PHedgehog(Gear^.Hedgehog)^.SpeechGear:= nil;
 	DeleteVisualGear(Gear)
 	end;
 end;
 
 procedure doStepSpeechBubble(Gear: PVisualGear; Steps: Longword);
 begin
-if (CurrentHedgehog^.SpeechGear <> nil) then DeleteVisualGear(CurrentHedgehog^.SpeechGear);
-CurrentHedgehog^.SpeechGear:= Gear;
+if (PHedgehog(Gear^.Hedgehog)^.SpeechGear <> nil) then DeleteVisualGear(PHedgehog(Gear^.Hedgehog)^.SpeechGear);
+PHedgehog(Gear^.Hedgehog)^.SpeechGear:= Gear;
 
 Gear^.Timer:= max(Length(Gear^.Text)*150,3000);