From ef91fb8e9d223f945e40b637c7fff0b279446717 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sat, 26 Dec 2015 14:37:36 +0100 Subject: [PATCH] Fixed commandline interpreter --- src/CBot/CBotStack.cpp | 10 +++++----- test/cbot/console/main.cpp | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp index 83babb85..dd544d74 100644 --- a/src/CBot/CBotStack.cpp +++ b/src/CBot/CBotStack.cpp @@ -559,24 +559,24 @@ void CBotStack::SetUserPtr(void* user) //////////////////////////////////////////////////////////////////////////////// bool CBotStack::ExecuteCall(long& nIdent, CBotToken* token, CBotVar** ppVar, const CBotTypResult& rettype) { - CBotTypResult res; + int res; // first looks by the identifier res = m_prog->GetExternalCalls()->DoCall(nullptr, nullptr, ppVar, this, rettype); - if (res.GetType() >= 0) return res.GetType(); + if (res >= 0) return res; res = m_prog->GetFunctions()->DoCall(nIdent, "", ppVar, this, token ); - if (res.GetType() >= 0) return res.GetType(); + if (res >= 0) return res; // if not found (recompile?) seeks by name nIdent = 0; res = m_prog->GetExternalCalls()->DoCall(token, nullptr, ppVar, this, rettype); - if (res.GetType() >= 0) return res.GetType(); + if (res >= 0) return res; res = m_prog->GetFunctions()->DoCall(nIdent, token->GetString(), ppVar, this, token ); - if (res.GetType() >= 0) return res.GetType(); + if (res >= 0) return res; SetError(CBotErrUndefFunc, token); return true; diff --git a/test/cbot/console/main.cpp b/test/cbot/console/main.cpp index b5e24b41..e6b1a4eb 100644 --- a/test/cbot/console/main.cpp +++ b/test/cbot/console/main.cpp @@ -5,6 +5,8 @@ #include "CBot/CBot.h" +using namespace CBot; + CBotTypResult cMessage(CBotVar* &var, void* user) { if ( var == nullptr ) return CBotTypResult(CBotErrLowParam);