From a2df003b7e3014aea60fb346b8ce4ad6338edef9 Mon Sep 17 00:00:00 2001 From: tomangelo2 Date: Fri, 8 May 2020 00:04:17 +0200 Subject: [PATCH] Fix radar function parameter type detection, fixes #1298 --- src/script/scriptfunc.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp index 0f519986..329d00fb 100644 --- a/src/script/scriptfunc.cpp +++ b/src/script/scriptfunc.cpp @@ -933,16 +933,13 @@ bool CScriptFunctions::rSearchAll(CBotVar* var, CBotVar* result, int& exception, static CBotTypResult compileRadar(CBotVar* &var, void* user, CBotTypResult returnValue) { - CBotVar* array; - if ( var == nullptr ) return returnValue; if ( var->GetType() == CBotTypArrayPointer ) { - array = var->GetItemList(); - if ( array == nullptr ) return returnValue; - if ( array->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type + CBotTypResult type = var->GetTypResult().GetTypElem(); + if ( type.GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadParam); //type } - else if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type + else if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadParam); // type var = var->GetNext(); if ( var == nullptr ) return returnValue; if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // angle