Fix radar function parameter type detection, fixes #1298

1164-fix
tomangelo2 2020-05-08 00:04:17 +02:00 committed by Mateusz Przybył
parent fb9fa49ce8
commit a2df003b7e
1 changed files with 3 additions and 6 deletions

View File

@ -933,16 +933,13 @@ bool CScriptFunctions::rSearchAll(CBotVar* var, CBotVar* result, int& exception,
static CBotTypResult compileRadar(CBotVar* &var, void* user, CBotTypResult returnValue) static CBotTypResult compileRadar(CBotVar* &var, void* user, CBotTypResult returnValue)
{ {
CBotVar* array;
if ( var == nullptr ) return returnValue; if ( var == nullptr ) return returnValue;
if ( var->GetType() == CBotTypArrayPointer ) if ( var->GetType() == CBotTypArrayPointer )
{ {
array = var->GetItemList(); CBotTypResult type = var->GetTypResult().GetTypElem();
if ( array == nullptr ) return returnValue; if ( type.GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadParam); //type
if ( array->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type
} }
else if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type else if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadParam); // type
var = var->GetNext(); var = var->GetNext();
if ( var == nullptr ) return returnValue; if ( var == nullptr ) return returnValue;
if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // angle if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // angle