Fixed some functions doesn't returning 0 if no error

Fix issue #917
master
tomangelo2 2017-03-02 23:01:55 +01:00
parent ac3fd15c5a
commit 588bf30b94
1 changed files with 7 additions and 9 deletions

View File

@ -413,9 +413,9 @@ bool CScriptFunctions::rDestroy(CBotVar* thisclass, CBotVar* var, CBotVar* resul
else else
err = ERR_WRONG_OBJ; err = ERR_WRONG_OBJ;
result->SetValInt(err); // indicates the error or ok
if ( err != ERR_OK ) if ( err != ERR_OK )
{ {
result->SetValInt(err); // return error
if ( script->m_errMode == ERM_STOP ) if ( script->m_errMode == ERM_STOP )
{ {
exception = err; exception = err;
@ -506,9 +506,9 @@ bool CScriptFunctions::rFactory(CBotVar* thisclass, CBotVar* var, CBotVar* resul
else else
err = ERR_WRONG_OBJ; err = ERR_WRONG_OBJ;
result->SetValInt(err); // indicates the error or ok
if ( err != ERR_OK ) if ( err != ERR_OK )
{ {
result->SetValInt(err); // return error
if ( script->m_errMode == ERM_STOP ) if ( script->m_errMode == ERM_STOP )
{ {
exception = err; exception = err;
@ -581,9 +581,9 @@ bool CScriptFunctions::rResearch(CBotVar* thisclass, CBotVar* var, CBotVar* resu
else else
err = ERR_WRONG_OBJ; err = ERR_WRONG_OBJ;
result->SetValInt(err); // indicates the error or ok
if ( err != ERR_OK ) if ( err != ERR_OK )
{ {
result->SetValInt(err); // return error
if( script->m_errMode == ERM_STOP ) if( script->m_errMode == ERM_STOP )
{ {
exception = err; exception = err;
@ -591,7 +591,7 @@ bool CScriptFunctions::rResearch(CBotVar* thisclass, CBotVar* var, CBotVar* resu
} }
return true; return true;
} }
return true; return true;
} }
@ -621,9 +621,9 @@ bool CScriptFunctions::rTakeOff(CBotVar* thisclass, CBotVar* var, CBotVar* resul
else else
err = ERR_WRONG_OBJ; err = ERR_WRONG_OBJ;
result->SetValInt(err); // indicates the error or ok
if ( err != ERR_OK ) if ( err != ERR_OK )
{ {
result->SetValInt(err); // return error
if ( script->m_errMode == ERM_STOP ) if ( script->m_errMode == ERM_STOP )
{ {
exception = err; exception = err;
@ -1229,10 +1229,9 @@ bool CScriptFunctions::rBuild(CBotVar* var, CBotVar* result, int& exception, voi
} }
} }
} }
result->SetValInt(err); // indicates the error or ok
if ( err != ERR_OK ) if ( err != ERR_OK )
{ {
result->SetValInt(err); // return error
if ( script->m_errMode == ERM_STOP ) if ( script->m_errMode == ERM_STOP )
{ {
exception = err; exception = err;
@ -2379,11 +2378,10 @@ bool CScriptFunctions::rFire(CBotVar* var, CBotVar* result, int& exception, void
if ( delay < 0.0f ) delay = -delay; if ( delay < 0.0f ) delay = -delay;
err = script->m_taskExecutor->StartTaskFire(delay); err = script->m_taskExecutor->StartTaskFire(delay);
} }
result->SetValInt(err); // indicates the error or ok
if ( err != ERR_OK ) if ( err != ERR_OK )
{ {
script->m_taskExecutor->StopForegroundTask(); script->m_taskExecutor->StopForegroundTask();
result->SetValInt(err); // shows the error
return true; return true;
} }
} }