added flag gfDisableWind to be used in lua scripts
authorHenek
Mon, 08 Nov 2010 23:07:43 +0100
changeset 4218 d90e9c89596b
parent 4217 721bfa5f4f31
child 4219 4162db7c11bb
added flag gfDisableWind to be used in lua scripts
hedgewars/uConsts.pas
hedgewars/uTeams.pas
--- a/hedgewars/uConsts.pas	Mon Nov 08 23:05:44 2010 +0100
+++ b/hedgewars/uConsts.pas	Mon Nov 08 23:07:43 2010 +0100
@@ -354,6 +354,7 @@
     gfInfAttack          = $00100000;
     gfResetWeps          = $00200000;
     gfPerHogAmmo         = $00400000;
+    gfDisableWind        = $00800000;           // only lua for now
     // NOTE: When adding new game flags, ask yourself
     // if a "game start notice" would be useful. If so,
     // add one in uWorld.pas - look for "AddGoal".
--- a/hedgewars/uTeams.pas	Mon Nov 08 23:05:44 2010 +0100
+++ b/hedgewars/uTeams.pas	Mon Nov 08 23:07:43 2010 +0100
@@ -275,15 +275,19 @@
 
 ResetKbd;
 
-cWindSpeed:= rndSign(GetRandom * 2 * cMaxWindSpeed);
-// cWindSpeedf:= cWindSpeed.QWordValue / _1.QWordValue throws 'Internal error 200502052' on Darwin
-// see http://mantis.freepascal.org/view.php?id=17714
-cWindSpeedf:= SignAs(cWindSpeed,cWindSpeed).QWordValue / SignAs(_1,_1).QWordValue;
-if cWindSpeed.isNegative then
-    CWindSpeedf := -cWindSpeedf;
-g:= AddGear(0, 0, gtATSmoothWindCh, 0, _0, _0, 1);
-g^.Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
+if (GameFlags and gfDisableWind) = 0 then
+    begin
+    cWindSpeed:= rndSign(GetRandom * 2 * cMaxWindSpeed);
+    // cWindSpeedf:= cWindSpeed.QWordValue / _1.QWordValue throws 'Internal error 200502052' on Darwin
+    // see http://mantis.freepascal.org/view.php?id=17714
+    cWindSpeedf:= SignAs(cWindSpeed,cWindSpeed).QWordValue / SignAs(_1,_1).QWordValue;
+    if cWindSpeed.isNegative then
+        CWindSpeedf := -cWindSpeedf;
+    g:= AddGear(0, 0, gtATSmoothWindCh, 0, _0, _0, 1);
+    g^.Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
 {$IFDEF DEBUGFILE}AddFileLog('Wind = '+FloatToStr(cWindSpeed));{$ENDIF}
+    end;
+
 ApplyAmmoChanges(CurrentHedgehog^);
 
 if not CurrentTeam^.ExtDriven then SetBinds(CurrentTeam^.Binds);