From 5f9261273adefcb6183dffefb6bd63e58530f22a Mon Sep 17 00:00:00 2001 From: lalien Date: Tue, 31 Mar 2009 12:15:33 +0000 Subject: [PATCH] Removed assertion in Random.cpp git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2648 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Standard Gaming Platform/Random.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Standard Gaming Platform/Random.cpp b/Standard Gaming Platform/Random.cpp index 6c390d04..60110d9d 100644 --- a/Standard Gaming Platform/Random.cpp +++ b/Standard Gaming Platform/Random.cpp @@ -33,7 +33,11 @@ UINT32 Random(UINT32 uiRange) BOOLEAN Chance( UINT32 uiChance ) { - AssertLE(uiChance, 100); + //AssertLE(uiChance, 100); + // lalien: since uiChance calculation is based on different values it can happen that uiChance is > than 100% + // It's not critical because uiChance >= 100 will always return TRUE. No need to crash the entire game. + // Make sure that uiChance value is not < than 0, or it can switch to positive + return (BOOLEAN)(Random( 100 ) < uiChance); } @@ -71,6 +75,10 @@ UINT32 PreRandom( UINT32 uiRange ) BOOLEAN PreChance( UINT32 uiChance ) { - AssertLE(uiChance, 100); + //AssertLE(uiChance, 100); + // lalien: since uiChance calculation is based on different values it can happen that uiChance is > than 100% + // It's not critical because uiChance >= 100 will always return TRUE. No need to crash the entire game. + // Make sure that uiChance value is not < than 0, or it can switch to positive + return (BOOLEAN)(PreRandom( 100 ) < uiChance); }