diff --git a/docs/rh-log.txt b/docs/rh-log.txt index b0ec5eab99..69cdf4b4e0 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,8 @@ +February 25, 2008 (Changes by Graf Zahl) +- Fixed: The DECORATE expression evaluator's random function could produce + incorrect results for ranges > 255. Changed so that FRandom's default + implementation is used instead. + February 21, 2008 - Fixed: DThinker::SerializeAll() did not serialize any thinkers in the FreshThinkers lists. These thinkers would still be saved in the savegame if diff --git a/src/thingdef/thingdef_exp.cpp b/src/thingdef/thingdef_exp.cpp index d0f8824435..62b6f03373 100644 --- a/src/thingdef/thingdef_exp.cpp +++ b/src/thingdef/thingdef_exp.cpp @@ -1477,23 +1477,7 @@ static ExpVal EvalExpression (ExpData *data, AActor *self, const PClass *cls) swap (max, min); } - if (max - min > 255) - { - int num1,num2,num3,num4; - - num1 = (*data->RNG)(); - num2 = (*data->RNG)(); - num3 = (*data->RNG)(); - num4 = (*data->RNG)(); - - val.Int = ((num1 << 24) | (num2 << 16) | (num3 << 8) | num4); - } - else - { - val.Int = (*data->RNG)(); - } - val.Int %= (max - min + 1); - val.Int += min; + val.Int = (*data->RNG)(max - min + 1) + min; } break;