# HG changeset patch # User nemo # Date 1270241859 0 # Node ID 0e52ca22c1e05fb56a10e0ad6e89894832c69703 # Parent 02139461250c1d46fd6572d179b5b1443c7b4d90 GetRandom(0) is illegal diff -r 02139461250c -r 0e52ca22c1e0 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