Apparently order of multiple getrandom in params is undefined. Also remove broken and pointless getrandom call.
authornemo
Sun, 15 Jul 2012 15:35:28 -0400
changeset 7391 588eabb4b384
parent 7389 15c3fb4882df
child 7393 3f203c62353b
Apparently order of multiple getrandom in params is undefined. Also remove broken and pointless getrandom call.
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsRender.pas
--- a/hedgewars/GSHandlers.inc	Sat Jul 14 23:19:09 2012 -0400
+++ b/hedgewars/GSHandlers.inc	Sun Jul 15 15:35:28 2012 -0400
@@ -4655,11 +4655,13 @@
 
                     // add some fire to the tunnel
                     if getRandom(6) = 0 then
-                        AddGear(x - Gear^.Radius + LongInt(getRandom(2 * Gear^.Radius)), y -
-                        getRandom(Gear^.Radius + 1), gtFlame, gsttmpFlag, _0, _0, 0);
+                        begin
+                        tmp:= GetRandom(2 * Gear^.Radius);
+                        AddGear(x - Gear^.Radius + tmp, y - GetRandom(Gear^.Radius + 1), gtFlame, gsttmpFlag, _0, _0, 0)
+                        end
                     end;
 
-                if getRandom(100) = 0 then
+                if random(100) = 0 then
                     AddVisualGear(x, y, vgtSmokeTrace); 
                 end
                 else dec(Gear^.Health, 5); // if underwater get additional damage
--- a/hedgewars/uGears.pas	Sat Jul 14 23:19:09 2012 -0400
+++ b/hedgewars/uGears.pas	Sun Jul 15 15:35:28 2012 -0400
@@ -453,7 +453,6 @@
     if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then
         inc(hiTicks) // we do not recieve a message for this
     end;
-
 ScriptCall('onGameTick');
 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
 inc(GameTicks)
--- a/hedgewars/uGearsHedgehog.pas	Sat Jul 14 23:19:09 2012 -0400
+++ b/hedgewars/uGearsHedgehog.pas	Sun Jul 15 15:35:28 2012 -0400
@@ -596,7 +596,8 @@
 procedure PickUp(HH, Gear: PGear);
 var s: shortstring;
     a: TAmmoType;
-    i: LongInt;
+    i, rx, ry: LongInt;
+    rdx, rdy: hwFloat;
     vga: PVisualGear;
     ag: PGear;
 begin
@@ -620,9 +621,15 @@
                         begin
 // Add spawning here...
                         AddRandomness(CheckSum xor GameTicks);
+
                         for i:= 0 to GetRandom(50)+50 do
-                            AddGear(GetRandom(rightX-leftX)+leftX, GetRandom(LAND_HEIGHT-topY)+topY, gtGenericFaller,
-                                    gstInvisible, _90-(GetRandomf*_360), _90-(GetRandomf*_360), GetRandom(500));
+                            begin
+                            rx:= GetRandom(rightX-leftX)+leftX;
+                            ry:= GetRandom(LAND_HEIGHT-topY)+topY;
+                            rdx:= _90-(GetRandomf*_360);
+                            rdy:= _90-(GetRandomf*_360);
+                            AddGear(rx, ry, gtGenericFaller, gstInvisible, rdx, rdy, GetRandom(500));
+                            end;
                         ag:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAddAmmo, gstInvisible, _0, _0, GetRandom(200)+100);
                         ag^.Pos:= Gear^.Pos;
                         ag^.Power:= Gear^.Power
--- a/hedgewars/uGearsRender.pas	Sat Jul 14 23:19:09 2012 -0400
+++ b/hedgewars/uGearsRender.pas	Sun Jul 15 15:35:28 2012 -0400
@@ -287,7 +287,6 @@
             dy:= -Cos(Gear^.Angle * pi / cMaxAngle);
             if cLaserSighting then
                 begin
-                GetRandom(2); // no, this does not prevent it, just makes things harder
                 lx:= GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle);
                 ly:= GetLaunchY(HH^.CurAmmoType, Gear^.Angle);