Fix OpenRA.GetRandomInteger crashing under certain circumstances

OpenRA.GetRandomInteger crashes when the supplied high value is less or
equal to the low value.  A situation where this might occur is when you
try to get a random member of a dynamically generated array that
happens to have only a single member.
This commit is contained in:
Oliver Brakmann
2014-02-01 00:04:24 +01:00
parent 6be0a26353
commit 2f9b1459a8

View File

@@ -43,7 +43,11 @@ OpenRA.SetWinState = function(player, winState)
end
OpenRA.GetRandomInteger = function(low, high)
if high <= low then
return low
else
return Internal.GetRandomInteger(low, high)
end
end
OpenRA.TakeOre = function(player, amount)