diff --git a/CHANGELOG.md b/CHANGELOG.md index 07c7d5b36..47e5bb485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -153,6 +153,7 @@ Bug #5167: Player can select and cast spells before magic menu is enabled Bug #5168: Force1stPerson and Force3rdPerson commands are not really force view change Bug #5169: Nested levelled items/creatures have significantly higher chance not to spawn + Bug #5175: Random script function returns an integer value Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI Feature #3025: Analogue gamepad movement controls diff --git a/components/compiler/exprparser.cpp b/components/compiler/exprparser.cpp index e3a306b8f..017e36373 100644 --- a/components/compiler/exprparser.cpp +++ b/components/compiler/exprparser.cpp @@ -489,7 +489,7 @@ namespace Compiler parseArguments ("l", scanner); Generator::random (mCode); - mOperands.push_back ('l'); + mOperands.push_back ('f'); mNextOperand = false; return true; diff --git a/components/interpreter/miscopcodes.hpp b/components/interpreter/miscopcodes.hpp index 29d1c063b..a77e0d7d8 100644 --- a/components/interpreter/miscopcodes.hpp +++ b/components/interpreter/miscopcodes.hpp @@ -190,9 +190,7 @@ namespace Interpreter throw std::runtime_error ( "random: argument out of range (Don't be so negative!)"); - Type_Integer value = Misc::Rng::rollDice(limit); // [o, limit) - - runtime[0].mInteger = value; + runtime[0].mFloat = static_cast(Misc::Rng::rollDice(limit)); // [o, limit) } };