From cfe44d6053c8bcce9f9ae887726a652502276c55 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 8 Mar 2005 15:28:01 +0000 Subject: Apparently, in IHNM opcode #75 can take three parameters. Added stub to avoid division by zero. svn-id: r17040 --- saga/sfuncs.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 176965a516..20e92cbd70 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -1549,9 +1549,23 @@ void Script::SF_protectResult(SCRIPTFUNC_PARAMS) { // Script function #75 (0x4b) void Script::sfRand(SCRIPTFUNC_PARAMS) { - int16 param = thread->pop(); + int16 param; + + if (_vm->getGameType() == GType_IHNM) { + // I don't know what this function does in IHNM, but apparently + // it can take three parameters. - thread->_returnValue = _vm->_rnd.getRandomNumber(param - 1); + debug(1, "stub: sfRand()"); + + for (int i = 0; i < nArgs; i++) { + thread->pop(); + } + + thread->_returnValue = 0; + } else { + param = thread->pop(); + thread->_returnValue = _vm->_rnd.getRandomNumber(param - 1); + } } // Script function #76 (0x4c) -- cgit v1.2.3