[colobot] 07/145: Fix method overloading

Didier Raboud odyx at moszumanska.debian.org
Mon Jul 11 12:56:12 UTC 2016


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

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

commit 02133d0bd48a54a17a0b5d59b596c009fb512c19
Author: melex750 <melex750 at users.noreply.github.com>
Date:   Mon Mar 21 07:56:52 2016 -0400

    Fix method overloading
---
 src/CBot/CBotClass.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/CBot/CBotClass.cpp b/src/CBot/CBotClass.cpp
index e701db8..27794d7 100644
--- a/src/CBot/CBotClass.cpp
+++ b/src/CBot/CBotClass.cpp
@@ -33,6 +33,7 @@
 #include "CBot/CBotExternalCall.h"
 #include "CBot/CBotStack.h"
 #include "CBot/CBotCStack.h"
+#include "CBot/CBotDefParam.h"
 #include "CBot/CBotUtils.h"
 #include "CBot/CBotFileUtils.h"
 #include "CBot/CBotCallMethode.h"
@@ -604,9 +605,14 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
                     // return a method precompiled in pass 1
                     CBotFunction*   pf = m_pMethod;
                     CBotFunction*   prev = nullptr;
-                    while ( pf != nullptr )
+                    CBotToken* ppp = p;
+                    CBotCStack* pStk = pStack->TokenStack(nullptr, true);
+                    CBotDefParam* params = CBotDefParam::Compile(p, pStk );
+                    delete pStk;
+                    p = ppp;
+                    while ( pf != nullptr )                             // search by name and parameters
                     {
-                        if (pf->GetName() == pp) break;
+                        if (pf->GetName() == pp && pf->CheckParam( params )) break;
                         prev = pf;
                         pf = pf->Next();
                     }
@@ -708,7 +714,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
                     i = CBotTwoOpExpr::Compile(p, pStack);
 
                     if ( !(type.Eq(CBotTypPointer) && pStack->GetTypResult().Eq(CBotTypNullPointer)) &&
-                         !TypesCompatibles( type, pStack->GetTypResult()) )
+                         !TypesCompatibles( type2, pStack->GetTypResult()) )
                     {
                         pStack->SetError(CBotErrBadType1, p->GetStart());
                         return false;

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