[colobot] 377/390: shield() rejects incorrect robots that try to invoke it (should fix #475)

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:22:07 UTC 2015


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

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit f69dfe34215ef565562e90270d8b7c0b5725640b
Author: Tomasz Kapuściński <tomaszkax86 at gmail.com>
Date:   Thu May 28 14:03:05 2015 +0200

    shield() rejects incorrect robots that try to invoke it (should fix #475)
---
 src/script/scriptfunc.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp
index b1e8992..2da058c 100644
--- a/src/script/scriptfunc.cpp
+++ b/src/script/scriptfunc.cpp
@@ -2628,6 +2628,18 @@ bool CScriptFunctions::rShield(CBotVar* var, CBotVar* result, int& exception, vo
     CObject*    pThis = static_cast<CObject *>(user);
     float       oper, radius;
     Error       err;
+
+    // only shielder can use shield()
+    if (pThis->GetType() != OBJECT_MOBILErs)
+    {
+        result->SetValInt(ERR_MANIP_VEH);  // return error
+        if (script->m_errMode == ERM_STOP)
+        {
+            exception = ERR_MANIP_VEH;
+            return false;
+        }
+        return true;
+    }
     
     oper = var->GetValFloat();  // 0=down, 1=up
     var = var->GetNext();

-- 
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