SRL Archive - Bugs

Bug with a lot of things,


Bad Boy JH

2010-11-16 02:46:04

Things such as RandomizeTile which uses RandomRange, which goes from -RanX to RanX, creates minor bugs because RandomRange(X, Y) cannot actually give us Y, but anything from X to Y - 1…

this should be changed…

Naike

2010-11-16 08:53:34

As I don't have the time this week, feel free to post a change, and explain with code.
That way we make all our little developers happier!

Bad Boy JH

2010-11-16 19:57:26

well, 3 fixes,
1. Change RandomRange(X, Y), so it can get all values between X and Y, Inclusive.
2. Create a simmilar function which gets all values between X and Y, inclusive, e.g.
Function RandomNumber(Num1, Num2: Integer): Integer;
begin
Result := RandomRange(Min(Num1, Num2), Max(Num1, Num2) + 1);
end;
and then change all the places it is used to be the new function.
3. Change all the places so it has RandomRange(X, Y + 1) instead of just RandomRange(X, Y)…

I personally prefer the second option, and the first can stuff up way to many things…