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 <[email protected]>
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

_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to