[colobot] 53/100: Fixed some functions doesn't returning 0 if no error

Didier Raboud odyx at moszumanska.debian.org
Thu Jun 1 18:10:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit 588bf30b94c375676a02ee46b68b291e7792c531
Author: tomangelo2 <tomangelo at wp.pl>
Date:   Thu Mar 2 23:01:55 2017 +0100

    Fixed some functions doesn't returning 0 if no error
    
    Fix issue #917
---
 src/script/scriptfunc.cpp | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp
index 1c1f985..e93d5fa 100644
--- a/src/script/scriptfunc.cpp
+++ b/src/script/scriptfunc.cpp
@@ -413,9 +413,9 @@ bool CScriptFunctions::rDestroy(CBotVar* thisclass, CBotVar* var, CBotVar* resul
     else
         err = ERR_WRONG_OBJ;
 
+	result->SetValInt(err); // indicates the error or ok
     if ( err != ERR_OK )
     {
-        result->SetValInt(err);  // return error
         if ( script->m_errMode == ERM_STOP )
         {
             exception = err;
@@ -506,9 +506,9 @@ bool CScriptFunctions::rFactory(CBotVar* thisclass, CBotVar* var, CBotVar* resul
     else
         err = ERR_WRONG_OBJ;
 
+	result->SetValInt(err); // indicates the error or ok
     if ( err != ERR_OK )
     {
-        result->SetValInt(err);  // return error
         if ( script->m_errMode == ERM_STOP )
         {
             exception = err;
@@ -581,9 +581,9 @@ bool CScriptFunctions::rResearch(CBotVar* thisclass, CBotVar* var, CBotVar* resu
     else
         err = ERR_WRONG_OBJ;
 
+	result->SetValInt(err); // indicates the error or ok
     if ( err != ERR_OK )
     {
-        result->SetValInt(err);  // return error
         if( script->m_errMode == ERM_STOP )
         {
             exception = err;
@@ -591,7 +591,7 @@ bool CScriptFunctions::rResearch(CBotVar* thisclass, CBotVar* var, CBotVar* resu
         }
         return true;
     }
-
+	
     return true;
 }
 
@@ -621,9 +621,9 @@ bool CScriptFunctions::rTakeOff(CBotVar* thisclass, CBotVar* var, CBotVar* resul
     else
         err = ERR_WRONG_OBJ;
 
+	result->SetValInt(err); // indicates the error or ok
     if ( err != ERR_OK )
     {
-        result->SetValInt(err);  // return error
         if ( script->m_errMode == ERM_STOP )
         {
             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 )
     {
-        result->SetValInt(err);  // return error
         if ( script->m_errMode == ERM_STOP )
         {
             exception = err;
@@ -2379,11 +2378,10 @@ bool CScriptFunctions::rFire(CBotVar* var, CBotVar* result, int& exception, void
             if ( delay < 0.0f ) delay = -delay;
             err = script->m_taskExecutor->StartTaskFire(delay);
         }
-
+		result->SetValInt(err); // indicates the error or ok
         if ( err != ERR_OK )
         {
             script->m_taskExecutor->StopForegroundTask();
-            result->SetValInt(err);  // shows the error
             return true;
         }
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list