GetRandom(0) is illegal
authornemo
Fri, 02 Apr 2010 20:57:39 +0000
changeset 3268 0e52ca22c1e0
parent 3267 02139461250c
child 3269 258d7f87c96e
GetRandom(0) is illegal
hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Fri Apr 02 20:49:23 2010 +0000
+++ b/hedgewars/uGears.pas	Fri Apr 02 20:57:39 2010 +0000
@@ -2170,16 +2170,21 @@
 
 t:=0;
 a:=aTot;
-h:= 0;
+h:= 1;
 // FIXME - shoppa is TEMPORARY REMOVE WHEN CRATE PROBABILITY ALLOWS DISABLING OF HEALTH CRATES
 // Preserving health crate distribution of 35% until that happens
-if not shoppa and ((GameFlags and gfInvulnerable) = 0) and ((aTot+uTot)<>0) then 
-    begin
-    h:= 3500;
-    t:= GetRandom(10000);
-    a:= 6500*aTot div (aTot+uTot)
-    end
-else t:= GetRandom(aTot+uTot);
+if (aTot+uTot) <> 0 then
+    if not shoppa and ((GameFlags and gfInvulnerable) = 0) then 
+        begin
+        h:= 3500;
+        t:= GetRandom(10000);
+        a:= 6500*aTot div (aTot+uTot)
+        end
+    else 
+        begin
+        t:= GetRandom(aTot+uTot);
+        h:= 0
+        end;
 
     
 if t<h then