From 07a4d6a16b9143321656724946852dda0e009ec1 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sat, 26 Dec 2015 14:19:24 +0100 Subject: [PATCH] CBot namespace --- src/CBot/CBotCStack.cpp | 12 +- src/CBot/CBotCStack.h | 9 +- src/CBot/CBotCallMethode.cpp | 8 +- src/CBot/CBotCallMethode.h | 4 + src/CBot/CBotClass.cpp | 9 +- src/CBot/CBotClass.h | 7 +- src/CBot/CBotDefParam.cpp | 9 +- src/CBot/CBotDefParam.h | 5 + src/CBot/CBotEnums.h | 12 +- src/CBot/CBotExternalCall.cpp | 7 +- src/CBot/CBotExternalCall.h | 7 +- src/CBot/CBotFileUtils.cpp | 9 +- src/CBot/CBotFileUtils.h | 11 +- src/CBot/CBotInstr/CBotBlock.cpp | 9 +- src/CBot/CBotInstr/CBotBlock.h | 9 +- src/CBot/CBotInstr/CBotBoolExpr.cpp | 10 +- src/CBot/CBotInstr/CBotBoolExpr.h | 9 +- src/CBot/CBotInstr/CBotBoolean.cpp | 9 +- src/CBot/CBotInstr/CBotBoolean.h | 9 +- src/CBot/CBotInstr/CBotBreak.cpp | 8 +- src/CBot/CBotInstr/CBotBreak.h | 9 +- src/CBot/CBotInstr/CBotCase.cpp | 8 +- src/CBot/CBotInstr/CBotCase.h | 9 +- src/CBot/CBotInstr/CBotCatch.cpp | 8 +- src/CBot/CBotInstr/CBotCatch.h | 8 +- src/CBot/CBotInstr/CBotClassInst.cpp | 9 +- src/CBot/CBotInstr/CBotClassInst.h | 8 +- src/CBot/CBotInstr/CBotCondition.cpp | 9 +- src/CBot/CBotInstr/CBotCondition.h | 8 +- src/CBot/CBotInstr/CBotDo.cpp | 9 +- src/CBot/CBotInstr/CBotDo.h | 9 +- src/CBot/CBotInstr/CBotEmpty.cpp | 9 +- src/CBot/CBotInstr/CBotEmpty.h | 8 +- src/CBot/CBotInstr/CBotExprAlpha.cpp | 8 +- src/CBot/CBotInstr/CBotExprAlpha.h | 8 +- src/CBot/CBotInstr/CBotExprBool.cpp | 9 +- src/CBot/CBotInstr/CBotExprBool.h | 9 +- src/CBot/CBotInstr/CBotExprNan.cpp | 9 +- src/CBot/CBotInstr/CBotExprNan.h | 8 +- src/CBot/CBotInstr/CBotExprNull.cpp | 9 +- src/CBot/CBotInstr/CBotExprNull.h | 9 +- src/CBot/CBotInstr/CBotExprNum.cpp | 7 +- src/CBot/CBotInstr/CBotExprNum.h | 8 +- src/CBot/CBotInstr/CBotExprUnaire.cpp | 9 +- src/CBot/CBotInstr/CBotExprUnaire.h | 9 +- src/CBot/CBotInstr/CBotExprVar.cpp | 8 +- src/CBot/CBotInstr/CBotExprVar.h | 9 +- src/CBot/CBotInstr/CBotExpression.cpp | 8 +- src/CBot/CBotInstr/CBotExpression.h | 9 +- src/CBot/CBotInstr/CBotFieldExpr.cpp | 9 +- src/CBot/CBotInstr/CBotFieldExpr.h | 9 +- src/CBot/CBotInstr/CBotFloat.cpp | 9 +- src/CBot/CBotInstr/CBotFloat.h | 9 +- src/CBot/CBotInstr/CBotFor.cpp | 8 +- src/CBot/CBotInstr/CBotFor.h | 9 +- src/CBot/CBotInstr/CBotFunction.cpp | 9 +- src/CBot/CBotInstr/CBotFunction.h | 8 +- src/CBot/CBotInstr/CBotIString.cpp | 9 +- src/CBot/CBotInstr/CBotIString.h | 9 +- src/CBot/CBotInstr/CBotIf.cpp | 8 +- src/CBot/CBotInstr/CBotIf.h | 9 +- src/CBot/CBotInstr/CBotIndexExpr.cpp | 9 +- src/CBot/CBotInstr/CBotIndexExpr.h | 8 +- src/CBot/CBotInstr/CBotInstArray.cpp | 9 +- src/CBot/CBotInstr/CBotInstArray.h | 9 +- src/CBot/CBotInstr/CBotInstr.cpp | 10 +- src/CBot/CBotInstr/CBotInstr.h | 5 + src/CBot/CBotInstr/CBotInstrCall.cpp | 9 +- src/CBot/CBotInstr/CBotInstrCall.h | 9 +- src/CBot/CBotInstr/CBotInstrMethode.cpp | 9 +- src/CBot/CBotInstr/CBotInstrMethode.h | 9 +- src/CBot/CBotInstr/CBotInstrUtils.cpp | 8 +- src/CBot/CBotInstr/CBotInstrUtils.h | 10 +- src/CBot/CBotInstr/CBotInt.cpp | 9 +- src/CBot/CBotInstr/CBotInt.h | 9 +- src/CBot/CBotInstr/CBotLeftExpr.cpp | 9 +- src/CBot/CBotInstr/CBotLeftExpr.h | 9 +- src/CBot/CBotInstr/CBotLeftExprVar.cpp | 5 + src/CBot/CBotInstr/CBotLeftExprVar.h | 4 + src/CBot/CBotInstr/CBotListArray.cpp | 8 +- src/CBot/CBotInstr/CBotListArray.h | 9 +- src/CBot/CBotInstr/CBotListExpression.cpp | 8 +- src/CBot/CBotInstr/CBotListExpression.h | 8 +- src/CBot/CBotInstr/CBotListInstr.cpp | 8 +- src/CBot/CBotInstr/CBotListInstr.h | 9 +- src/CBot/CBotInstr/CBotLogicExpr.cpp | 7 +- src/CBot/CBotInstr/CBotLogicExpr.h | 9 +- src/CBot/CBotInstr/CBotNew.cpp | 10 +- src/CBot/CBotInstr/CBotNew.h | 9 +- src/CBot/CBotInstr/CBotParExpr.cpp | 9 +- src/CBot/CBotInstr/CBotParExpr.h | 9 +- src/CBot/CBotInstr/CBotPostIncExpr.cpp | 9 +- src/CBot/CBotInstr/CBotPostIncExpr.h | 8 +- src/CBot/CBotInstr/CBotPreIncExpr.cpp | 8 +- src/CBot/CBotInstr/CBotPreIncExpr.h | 9 +- src/CBot/CBotInstr/CBotReturn.cpp | 9 +- src/CBot/CBotInstr/CBotReturn.h | 8 +- src/CBot/CBotInstr/CBotSwitch.cpp | 11 +- src/CBot/CBotInstr/CBotSwitch.h | 9 +- src/CBot/CBotInstr/CBotThrow.cpp | 9 +- src/CBot/CBotInstr/CBotThrow.h | 9 +- src/CBot/CBotInstr/CBotTry.cpp | 12 +- src/CBot/CBotInstr/CBotTry.h | 9 +- src/CBot/CBotInstr/CBotTwoOpExpr.cpp | 9 +- src/CBot/CBotInstr/CBotTwoOpExpr.h | 9 +- src/CBot/CBotInstr/CBotWhile.cpp | 8 +- src/CBot/CBotInstr/CBotWhile.h | 8 +- src/CBot/CBotProgram.cpp | 39 ++-- src/CBot/CBotProgram.h | 5 + src/CBot/CBotStack.cpp | 5 + src/CBot/CBotStack.h | 9 +- src/CBot/CBotToken.cpp | 5 + src/CBot/CBotToken.h | 5 + src/CBot/CBotTypResult.cpp | 29 +-- src/CBot/CBotTypResult.h | 5 + src/CBot/CBotUtils.cpp | 9 +- src/CBot/CBotUtils.h | 14 +- src/CBot/CBotVar/CBotVar.cpp | 10 +- src/CBot/CBotVar/CBotVar.h | 5 + src/CBot/CBotVar/CBotVarArray.cpp | 10 +- src/CBot/CBotVar/CBotVarArray.h | 5 + src/CBot/CBotVar/CBotVarBoolean.cpp | 5 + src/CBot/CBotVar/CBotVarBoolean.h | 5 + src/CBot/CBotVar/CBotVarClass.cpp | 9 +- src/CBot/CBotVar/CBotVarClass.h | 5 + src/CBot/CBotVar/CBotVarFloat.cpp | 9 +- src/CBot/CBotVar/CBotVarFloat.h | 5 + src/CBot/CBotVar/CBotVarInt.cpp | 9 +- src/CBot/CBotVar/CBotVarInt.h | 5 + src/CBot/CBotVar/CBotVarPointer.cpp | 9 +- src/CBot/CBotVar/CBotVarPointer.h | 5 + src/CBot/CBotVar/CBotVarString.cpp | 8 +- src/CBot/CBotVar/CBotVarString.h | 5 + src/CBot/README.txt | 5 + src/CBot/stdlib/Compilation.cpp | 7 +- src/CBot/stdlib/Compilation.h | 7 +- src/CBot/stdlib/FileFunctions.cpp | 7 +- src/CBot/stdlib/MathFunctions.cpp | 7 +- src/CBot/stdlib/StringFunctions.cpp | 4 + src/CBot/stdlib/stdlib.h | 7 +- src/CBot/stdlib/stdlib_public.h | 7 +- src/common/restext.cpp | 122 +++++----- src/level/robotmain.cpp | 24 +- .../implementation/programmable_impl.cpp | 10 +- src/object/object.cpp | 2 +- src/object/object.h | 8 +- src/script/script.cpp | 62 ++--- src/script/script.h | 4 +- src/script/scriptfunc.cpp | 4 +- src/script/scriptfunc.h | 211 +++++++++--------- test/unit/CBot/CBot.cpp | 2 + test/unit/CBot/CBotToken_test.cpp | 80 +++---- 152 files changed, 910 insertions(+), 824 deletions(-) diff --git a/src/CBot/CBotCStack.cpp b/src/CBot/CBotCStack.cpp index d05f4450..fa407776 100644 --- a/src/CBot/CBotCStack.cpp +++ b/src/CBot/CBotCStack.cpp @@ -18,21 +18,17 @@ */ -// Modules inlcude #include "CBot/CBotCStack.h" #include "CBot/CBotToken.h" -#include "CBotExternalCall.h" +#include "CBot/CBotExternalCall.h" #include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotInstr/CBotFunction.h" -// Local include - -// Global include - - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotProgram* CBotCStack::m_prog = nullptr; // init the static variable @@ -397,3 +393,5 @@ bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam) return false; } + +} diff --git a/src/CBot/CBotCStack.h b/src/CBot/CBotCStack.h index 7e66878a..fe768773 100644 --- a/src/CBot/CBotCStack.h +++ b/src/CBot/CBotCStack.h @@ -19,13 +19,12 @@ #pragma once -// Modules inlcude -#include +#include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotProgram.h" -// Local include +namespace CBot +{ -// Global include class CBotInstr; class CBotDefParam; class CBotToken; @@ -266,3 +265,5 @@ private: static CBotProgram* m_prog; static CBotTypResult m_retTyp; }; + +} // namespace CBot diff --git a/src/CBot/CBotCallMethode.cpp b/src/CBot/CBotCallMethode.cpp index a66ebd2c..3b5e09c9 100644 --- a/src/CBot/CBotCallMethode.cpp +++ b/src/CBot/CBotCallMethode.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotCallMethode.h" #include "CBot/CBotUtils.h" @@ -26,9 +25,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// @@ -111,3 +109,5 @@ int CBotCallMethode::DoCall(const std::string& name, CBotVar* pThis, CBotVar** p return -1; } + +} // namespace CBot diff --git a/src/CBot/CBotCallMethode.h b/src/CBot/CBotCallMethode.h index 17fab20c..6b70712a 100644 --- a/src/CBot/CBotCallMethode.h +++ b/src/CBot/CBotCallMethode.h @@ -22,6 +22,9 @@ #include "CBot/CBotTypResult.h" #include "CBot/CBotUtils.h" +namespace CBot +{ + class CBotVar; class CBotCStack; class CBotStack; @@ -82,3 +85,4 @@ private: friend class CBotClass; }; +} // namespace CBot diff --git a/src/CBot/CBotClass.cpp b/src/CBot/CBotClass.cpp index 8e8d8e2d..9fc3e171 100644 --- a/src/CBot/CBotClass.cpp +++ b/src/CBot/CBotClass.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotClass.h" #include "CBot/CBotInstr/CBotNew.h" @@ -37,10 +36,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotClass* CBotClass::m_ExClass = nullptr; @@ -826,3 +823,5 @@ CBotClass* CBotClass::Compile(CBotToken* &p, CBotCStack* pStack) pStack->SetError(CBotErrNoTerminator, p); return nullptr; } + +} // namespace CBot diff --git a/src/CBot/CBotClass.h b/src/CBot/CBotClass.h index 152849af..a688a860 100644 --- a/src/CBot/CBotClass.h +++ b/src/CBot/CBotClass.h @@ -25,6 +25,9 @@ #include +namespace CBot +{ + class CBotCallMethode; class CBotFunction; class CBotProgram; @@ -386,4 +389,6 @@ private: int m_cptOne; //! Processes waiting for sync. CBotProgram* m_ProgInLock[5]; -}; \ No newline at end of file +}; + +} // namespace CBot diff --git a/src/CBot/CBotDefParam.cpp b/src/CBot/CBotDefParam.cpp index 6718326c..5cb333e3 100644 --- a/src/CBot/CBotDefParam.cpp +++ b/src/CBot/CBotDefParam.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotDefParam.h" #include "CBot/CBotUtils.h" @@ -25,11 +24,11 @@ #include "CBot/CBotVar/CBotVarClass.h" -// Local include - -// Global include #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotDefParam::CBotDefParam() { @@ -189,3 +188,5 @@ std::string CBotDefParam::GetParamString() param += m_token.GetString(); return param; } + +} // namespace CBot diff --git a/src/CBot/CBotDefParam.h b/src/CBot/CBotDefParam.h index 61ca27ce..a30dcf22 100644 --- a/src/CBot/CBotDefParam.h +++ b/src/CBot/CBotDefParam.h @@ -23,6 +23,9 @@ #include "CBot/CBotStack.h" #include "CBot/CBotUtils.h" +namespace CBot +{ + class CBotCStack; class CBotStack; class CBotVar; @@ -94,3 +97,5 @@ private: CBotTypResult m_type; long m_nIdent; }; + +} // namespace CBot diff --git a/src/CBot/CBotEnums.h b/src/CBot/CBotEnums.h index 61744392..8f6d691b 100644 --- a/src/CBot/CBotEnums.h +++ b/src/CBot/CBotEnums.h @@ -23,9 +23,11 @@ * \file CBotEnums.h * \brief Some enum values used across the CBot engine */ + +namespace CBot +{ /** - * \enum CBotType * \brief Defines known types. This types are modeled on Java types. * * Do not change the order of elements. @@ -55,7 +57,6 @@ enum CBotType }; /** - * \enum CBotGet * \brief Different modes for CBotProgram::GetPosition */ enum CBotGet @@ -67,7 +68,6 @@ enum CBotGet }; /** - * \enum TokenId * \brief This enum contains possible token types */ enum TokenId @@ -168,7 +168,6 @@ enum TokenId }; /** - * \enum TokenType * \brief Types of tokens */ enum TokenType { @@ -181,7 +180,6 @@ enum TokenType { }; /** - * \enum CBotError * \brief This enum contains possible CBot error values. Values in range 5000-5999 are compile errors, 6000-6999 are runtime errors * * Note that other values ​​may be returned, for example exceptions for user-defined builtin functions, or "throw" instruction @@ -255,5 +253,7 @@ enum CBotError : int CBotErrRead = 6014, //!< error while reading CBotErrWrite = 6015, //!< writing error - TX_MAX, //!< Max errors + CBotErrMAX, //!< Max errors }; + +} // namespace CBot diff --git a/src/CBot/CBotExternalCall.cpp b/src/CBot/CBotExternalCall.cpp index ca37dc50..4e03161c 100644 --- a/src/CBot/CBotExternalCall.cpp +++ b/src/CBot/CBotExternalCall.cpp @@ -26,6 +26,9 @@ #include "CBot/CBotVar/CBotVar.h" +namespace CBot +{ + void CBotExternalCallList::Clear() { m_list.clear(); @@ -206,4 +209,6 @@ bool CBotExternalCallDefaultClass::Run(CBotVar* thisVar, CBotStack* pStack) } return true; -} \ No newline at end of file +} + +} // namespace CBot diff --git a/src/CBot/CBotExternalCall.h b/src/CBot/CBotExternalCall.h index e7171ca4..9fc84cbd 100644 --- a/src/CBot/CBotExternalCall.h +++ b/src/CBot/CBotExternalCall.h @@ -27,6 +27,9 @@ #include #include +namespace CBot +{ + class CBotStack; class CBotCStack; class CBotVar; @@ -211,4 +214,6 @@ public: private: std::map> m_list{}; void* m_user = nullptr; -}; \ No newline at end of file +}; + +} // namespace CBot diff --git a/src/CBot/CBotFileUtils.cpp b/src/CBot/CBotFileUtils.cpp index c3be54a1..5112d485 100644 --- a/src/CBot/CBotFileUtils.cpp +++ b/src/CBot/CBotFileUtils.cpp @@ -17,17 +17,14 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotFileUtils.h" #include "CBot/CBotClass.h" #include "CBot/CBotEnums.h" #include "CBot/CBotUtils.h" -// Local include - -// Global include - +namespace CBot +{ // file management @@ -172,3 +169,5 @@ bool ReadType(FILE* pf, CBotTypResult &type) } return true; } + +} // namespace CBot diff --git a/src/CBot/CBotFileUtils.h b/src/CBot/CBotFileUtils.h index 534634af..a962f3b3 100644 --- a/src/CBot/CBotFileUtils.h +++ b/src/CBot/CBotFileUtils.h @@ -19,15 +19,12 @@ #pragma once -// Modules inlcude - -// Local include - -// Global include #include #include -// Forward declaration +namespace CBot +{ + class CBotVar; class CBotTypResult; @@ -154,3 +151,5 @@ bool WriteType(FILE* pf, const CBotTypResult &type); * \return */ bool ReadType(FILE* pf, CBotTypResult &type); + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotBlock.cpp b/src/CBot/CBotInstr/CBotBlock.cpp index 105b718a..e6113d4c 100644 --- a/src/CBot/CBotInstr/CBotBlock.cpp +++ b/src/CBot/CBotInstr/CBotBlock.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotBlock.h" #include "CBot/CBotCStack.h" @@ -25,10 +24,8 @@ #include "CBot/CBotDefines.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotInstr* CBotBlock::Compile(CBotToken* &p, CBotCStack* pStack, bool bLocal) @@ -71,3 +68,5 @@ CBotInstr* CBotBlock::CompileBlkOrInst(CBotToken* &p, CBotCStack* pStack, bool b // (*) is the case in the following statement // if (1 == 1) int x = 0; // where the variable x is known only in the block following the if + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotBlock.h b/src/CBot/CBotInstr/CBotBlock.h index c88e5006..72dc87bb 100644 --- a/src/CBot/CBotInstr/CBotBlock.h +++ b/src/CBot/CBotInstr/CBotBlock.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotBlock class An instruction block { .... }. @@ -62,3 +59,5 @@ private: CBotBlock() = delete; CBotBlock(const CBotBlock &) = delete; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotBoolExpr.cpp b/src/CBot/CBotInstr/CBotBoolExpr.cpp index a3251380..bc0f6f2e 100644 --- a/src/CBot/CBotInstr/CBotBoolExpr.cpp +++ b/src/CBot/CBotInstr/CBotBoolExpr.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotBoolExpr.h" #include "CBot/CBotInstr/CBotTwoOpExpr.h" @@ -25,11 +24,8 @@ #include "CBot/CBotDefines.h" -// Local include - -// Global include - - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotInstr* CBotBoolExpr::Compile(CBotToken* &p, CBotCStack* pStack) @@ -50,3 +46,5 @@ CBotInstr* CBotBoolExpr::Compile(CBotToken* &p, CBotCStack* pStack) delete inst; return nullptr; } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotBoolExpr.h b/src/CBot/CBotInstr/CBotBoolExpr.h index 31545029..767b6a5f 100644 --- a/src/CBot/CBotInstr/CBotBoolExpr.h +++ b/src/CBot/CBotInstr/CBotBoolExpr.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotBoolExpr class Compile a statement such as "(condition)" @@ -45,3 +42,5 @@ public: */ static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack); }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotBoolean.cpp b/src/CBot/CBotInstr/CBotBoolean.cpp index 3cbf45cf..c3dcadce 100644 --- a/src/CBot/CBotInstr/CBotBoolean.cpp +++ b/src/CBot/CBotInstr/CBotBoolean.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotBoolean.h" #include "CBot/CBotInstr/CBotLeftExprVar.h" #include "CBot/CBotInstr/CBotTwoOpExpr.h" @@ -28,10 +27,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotBoolean::CBotBoolean() @@ -176,3 +173,5 @@ void CBotBoolean::RestoreState(CBotStack* &pj, bool bMain) if (m_next2b) m_next2b->RestoreState(pile, bMain); // other(s) definition(s) } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotBoolean.h b/src/CBot/CBotInstr/CBotBoolean.h index 78b49093..1197db87 100644 --- a/src/CBot/CBotInstr/CBotBoolean.h +++ b/src/CBot/CBotInstr/CBotBoolean.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotBoolean class Defining a boolean variable int a, b = false; @@ -74,3 +71,5 @@ private: //! A value to put, if there is. CBotInstr* m_expr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotBreak.cpp b/src/CBot/CBotInstr/CBotBreak.cpp index d76588b4..524a50e0 100644 --- a/src/CBot/CBotInstr/CBotBreak.cpp +++ b/src/CBot/CBotInstr/CBotBreak.cpp @@ -17,15 +17,13 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotBreak.h" #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotBreak::CBotBreak() @@ -94,3 +92,5 @@ void CBotBreak :: RestoreState(CBotStack* &pj, bool bMain) { if ( bMain ) pj->RestoreStack(this); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotBreak.h b/src/CBot/CBotInstr/CBotBreak.h index ce65b336..d7ad068c 100644 --- a/src/CBot/CBotInstr/CBotBreak.h +++ b/src/CBot/CBotInstr/CBotBreak.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotBreak class Compiles instruction "break" or "continu". @@ -73,3 +70,5 @@ private: std::string m_label; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotCase.cpp b/src/CBot/CBotInstr/CBotCase.cpp index 96c22ff4..b612fa1f 100644 --- a/src/CBot/CBotInstr/CBotCase.cpp +++ b/src/CBot/CBotInstr/CBotCase.cpp @@ -17,16 +17,14 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotCase.h" #include "CBot/CBotInstr/CBotExprNum.h" #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotCase::CBotCase() @@ -90,3 +88,5 @@ bool CBotCase::CompCase(CBotStack* &pile, int val) while (!m_Value->Execute(pile)); // puts the value on the correspondent stack (without interruption) return (pile->GetVal() == val); // compared with the given value } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotCase.h b/src/CBot/CBotInstr/CBotCase.h index ebd67485..e0445ea1 100644 --- a/src/CBot/CBotInstr/CBotCase.h +++ b/src/CBot/CBotInstr/CBotCase.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotCase class Compiles instruction "case" we are bound to the @@ -81,3 +78,5 @@ private: //! Value to compare. CBotInstr* m_Value; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotCatch.cpp b/src/CBot/CBotInstr/CBotCatch.cpp index 7d4f32c1..5aca41eb 100644 --- a/src/CBot/CBotInstr/CBotCatch.cpp +++ b/src/CBot/CBotInstr/CBotCatch.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotCatch.h" #include "CBot/CBotInstr/CBotBlock.h" #include "CBot/CBotInstr/CBotExpression.h" @@ -27,9 +26,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotCatch::CBotCatch() @@ -112,3 +110,5 @@ bool CBotCatch :: TestCatch(CBotStack* &pile, int val) return true; } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotCatch.h b/src/CBot/CBotInstr/CBotCatch.h index eec4196f..d5f74057 100644 --- a/src/CBot/CBotInstr/CBotCatch.h +++ b/src/CBot/CBotInstr/CBotCatch.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotCatch class. Compiles instruction "catch". @@ -91,3 +89,5 @@ private: friend class CBotTry; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotClassInst.cpp b/src/CBot/CBotInstr/CBotClassInst.cpp index a7a903af..26662b86 100644 --- a/src/CBot/CBotInstr/CBotClassInst.cpp +++ b/src/CBot/CBotInstr/CBotClassInst.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBotClassInst.h" #include "CBot/CBotInstr/CBotInstrUtils.h" @@ -33,10 +32,8 @@ #include "CBot/CBotVar/CBotVarPointer.h" #include "CBot/CBotVar/CBotVarClass.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotClassInst::CBotClassInst() @@ -439,3 +436,5 @@ void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain) if ( m_next2b != nullptr ) m_next2b->RestoreState(pile, bMain); // other(s) definition(s) } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotClassInst.h b/src/CBot/CBotInstr/CBotClassInst.h index 743e39e0..dd7375a1 100644 --- a/src/CBot/CBotInstr/CBotClassInst.h +++ b/src/CBot/CBotInstr/CBotClassInst.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotClassInst class Definition of an element of any class. @@ -83,3 +81,5 @@ private: long m_nMethodeIdent; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotCondition.cpp b/src/CBot/CBotInstr/CBotCondition.cpp index 72a70b2d..8b68f403 100644 --- a/src/CBot/CBotInstr/CBotCondition.cpp +++ b/src/CBot/CBotInstr/CBotCondition.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotCondition.h" #include "CBot/CBotInstr/CBotBoolExpr.h" @@ -25,10 +24,8 @@ #include "CBot/CBotDefines.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotInstr* CBotCondition::Compile(CBotToken* &p, CBotCStack* pStack) @@ -52,3 +49,5 @@ CBotInstr* CBotCondition::Compile(CBotToken* &p, CBotCStack* pStack) return nullptr; } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotCondition.h b/src/CBot/CBotInstr/CBotCondition.h index 334354f7..6b1f28fd 100644 --- a/src/CBot/CBotInstr/CBotCondition.h +++ b/src/CBot/CBotInstr/CBotCondition.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotCondition class This class has no constructor, because there @@ -44,3 +42,5 @@ public: */ static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack); }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotDo.cpp b/src/CBot/CBotInstr/CBotDo.cpp index 60cb4274..4c51f7d1 100644 --- a/src/CBot/CBotInstr/CBotDo.cpp +++ b/src/CBot/CBotInstr/CBotDo.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotDo.h" #include "CBot/CBotInstr/CBotBlock.h" #include "CBot/CBotInstr/CBotCondition.h" @@ -25,10 +24,8 @@ #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotDo::CBotDo() @@ -157,3 +154,5 @@ void CBotDo :: RestoreState(CBotStack* &pj, bool bMain) return; } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotDo.h b/src/CBot/CBotInstr/CBotDo.h index b2cb6463..cdf06c99 100644 --- a/src/CBot/CBotInstr/CBotDo.h +++ b/src/CBot/CBotInstr/CBotDo.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ class CBotDo : public CBotInstr { @@ -71,3 +68,5 @@ private: //! A label if there is std::string m_label; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotEmpty.cpp b/src/CBot/CBotInstr/CBotEmpty.cpp index ba9a9fd3..e3dac2c6 100644 --- a/src/CBot/CBotInstr/CBotEmpty.cpp +++ b/src/CBot/CBotInstr/CBotEmpty.cpp @@ -17,17 +17,14 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotEmpty.h" #include "CBot/CBotStack.h" #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// bool CBotEmpty::Execute(CBotStack* &pj) @@ -42,3 +39,5 @@ bool CBotEmpty::Execute(CBotStack* &pj) void CBotEmpty::RestoreState(CBotStack* &pj, bool bMain) { } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotEmpty.h b/src/CBot/CBotInstr/CBotEmpty.h index ebbee7b1..e48456dd 100644 --- a/src/CBot/CBotInstr/CBotEmpty.h +++ b/src/CBot/CBotInstr/CBotEmpty.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotEmpty class @@ -45,3 +43,5 @@ class CBotEmpty : public CBotInstr */ void RestoreState(CBotStack* &pj, bool bMain) override; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprAlpha.cpp b/src/CBot/CBotInstr/CBotExprAlpha.cpp index 641eee1e..71fcdfec 100644 --- a/src/CBot/CBotInstr/CBotExprAlpha.cpp +++ b/src/CBot/CBotInstr/CBotExprAlpha.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotExprAlpha.h" #include "CBot/CBotStack.h" @@ -25,9 +24,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotExprAlpha::CBotExprAlpha() @@ -80,3 +78,5 @@ void CBotExprAlpha::RestoreState(CBotStack* &pj, bool bMain) { if (bMain) pj->RestoreStack(this); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprAlpha.h b/src/CBot/CBotInstr/CBotExprAlpha.h index 10f4e240..d7d5bf33 100644 --- a/src/CBot/CBotInstr/CBotExprAlpha.h +++ b/src/CBot/CBotInstr/CBotExprAlpha.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotExprAlpha class Expression representing a string. @@ -65,3 +63,5 @@ public: */ void RestoreState(CBotStack* &pj, bool bMain) override; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprBool.cpp b/src/CBot/CBotInstr/CBotExprBool.cpp index ab639ed4..6160e82f 100644 --- a/src/CBot/CBotInstr/CBotExprBool.cpp +++ b/src/CBot/CBotInstr/CBotExprBool.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotExprBool.h" #include "CBot/CBotStack.h" @@ -25,10 +24,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotExprBool::CBotExprBool() @@ -82,3 +79,5 @@ void CBotExprBool::RestoreState(CBotStack* &pj, bool bMain) { if (bMain) pj->RestoreStack(this); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprBool.h b/src/CBot/CBotInstr/CBotExprBool.h index ac1d84fd..1c9f8e9a 100644 --- a/src/CBot/CBotInstr/CBotExprBool.h +++ b/src/CBot/CBotInstr/CBotExprBool.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotExprBool class Compile a token representing true or false. @@ -66,3 +63,5 @@ public: */ void RestoreState(CBotStack* &pj, bool bMain) override; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprNan.cpp b/src/CBot/CBotInstr/CBotExprNan.cpp index 02d07ba4..7c1a411b 100644 --- a/src/CBot/CBotInstr/CBotExprNan.cpp +++ b/src/CBot/CBotInstr/CBotExprNan.cpp @@ -17,17 +17,14 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotExprNan.h" #include "CBot/CBotStack.h" #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotExprNan::CBotExprNan() @@ -57,3 +54,5 @@ void CBotExprNan::RestoreState(CBotStack* &pj, bool bMain) { if (bMain) pj->RestoreStack(this); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprNan.h b/src/CBot/CBotInstr/CBotExprNan.h index 623502a7..b2268e8a 100644 --- a/src/CBot/CBotInstr/CBotExprNan.h +++ b/src/CBot/CBotInstr/CBotExprNan.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotExprNan class Management of the operand "nan". @@ -57,3 +55,5 @@ public: */ void RestoreState(CBotStack* &pj, bool bMain) override; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprNull.cpp b/src/CBot/CBotInstr/CBotExprNull.cpp index 25cad7d1..22923798 100644 --- a/src/CBot/CBotInstr/CBotExprNull.cpp +++ b/src/CBot/CBotInstr/CBotExprNull.cpp @@ -17,17 +17,14 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotExprNull.h" #include "CBot/CBotStack.h" #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotExprNull::CBotExprNull() @@ -58,3 +55,5 @@ void CBotExprNull::RestoreState(CBotStack* &pj, bool bMain) { if (bMain) pj->RestoreStack(this); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprNull.h b/src/CBot/CBotInstr/CBotExprNull.h index 473ddb60..bd7ce1b3 100644 --- a/src/CBot/CBotInstr/CBotExprNull.h +++ b/src/CBot/CBotInstr/CBotExprNull.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotExprNull class Management of the operand "null". @@ -58,3 +55,5 @@ public: */ void RestoreState(CBotStack* &pj, bool bMain) override; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprNum.cpp b/src/CBot/CBotInstr/CBotExprNum.cpp index cc2beb0b..c711ea88 100644 --- a/src/CBot/CBotInstr/CBotExprNum.cpp +++ b/src/CBot/CBotInstr/CBotExprNum.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotExprNum.h" #include "CBot/CBotStack.h" @@ -27,9 +26,8 @@ #include "CBot/CBotUtils.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotExprNum::CBotExprNum() @@ -117,3 +115,4 @@ void CBotExprNum::RestoreState(CBotStack* &pj, bool bMain) if (bMain) pj->RestoreStack(this); } +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprNum.h b/src/CBot/CBotInstr/CBotExprNum.h index 7195f7bb..7ec76bfd 100644 --- a/src/CBot/CBotInstr/CBotExprNum.h +++ b/src/CBot/CBotInstr/CBotExprNum.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotExprNum class Expression representing a number. @@ -76,3 +74,5 @@ private: float m_valfloat; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprUnaire.cpp b/src/CBot/CBotInstr/CBotExprUnaire.cpp index 656bda9b..92130e19 100644 --- a/src/CBot/CBotInstr/CBotExprUnaire.cpp +++ b/src/CBot/CBotInstr/CBotExprUnaire.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotExprUnaire.h" #include "CBot/CBotInstr/CBotParExpr.h" @@ -26,10 +25,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotExprUnaire::CBotExprUnaire() @@ -122,3 +119,5 @@ void CBotExprUnaire::RestoreState(CBotStack* &pj, bool bMain) return; } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprUnaire.h b/src/CBot/CBotInstr/CBotExprUnaire.h index b015f341..6a3653d8 100644 --- a/src/CBot/CBotInstr/CBotExprUnaire.h +++ b/src/CBot/CBotInstr/CBotExprUnaire.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotExprUnaire class Unary expression. Compile an unary expression @@ -71,3 +68,5 @@ private: //! Expression to be evaluated. CBotInstr* m_Expr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprVar.cpp b/src/CBot/CBotInstr/CBotExprVar.cpp index da534886..44431dba 100644 --- a/src/CBot/CBotInstr/CBotExprVar.cpp +++ b/src/CBot/CBotInstr/CBotExprVar.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotExprVar.h" #include "CBot/CBotInstr/CBotInstrMethode.h" #include "CBot/CBotInstr/CBotExpression.h" @@ -29,9 +28,8 @@ #include "CBot/CBotVar/CBotVarArray.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotExprVar::CBotExprVar() @@ -305,3 +303,5 @@ void CBotExprVar::RestoreStateVar(CBotStack* &pj, bool bMain) if (m_next3 != nullptr) m_next3->RestoreStateVar(pj, bMain); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExprVar.h b/src/CBot/CBotInstr/CBotExprVar.h index 23063136..76b72d71 100644 --- a/src/CBot/CBotInstr/CBotExprVar.h +++ b/src/CBot/CBotInstr/CBotExprVar.h @@ -19,16 +19,13 @@ #pragma once -// Modules inlcude #include "CBot/CBotDefines.h" #include "CBot/CBotInstr/CBotInstr.h" #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotExprVar class Expression for the variable name. Compile a @@ -103,3 +100,5 @@ private: friend class CBotPreIncExpr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExpression.cpp b/src/CBot/CBotInstr/CBotExpression.cpp index 0f95625e..25560561 100644 --- a/src/CBot/CBotInstr/CBotExpression.cpp +++ b/src/CBot/CBotInstr/CBotExpression.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotExpression.h" #include "CBot/CBotInstr/CBotInstrUtils.h" @@ -29,11 +28,10 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include #include +namespace CBot +{ ////////////////////////////////////////////////////////////////////////////////////// CBotExpression::CBotExpression() @@ -297,3 +295,5 @@ void CBotExpression::RestoreState(CBotStack* &pj, bool bMain) } } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotExpression.h b/src/CBot/CBotInstr/CBotExpression.h index a854d8bf..613cc51c 100644 --- a/src/CBot/CBotInstr/CBotExpression.h +++ b/src/CBot/CBotInstr/CBotExpression.h @@ -19,15 +19,12 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotLeftExpr.h" #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotExpression class Compiles a statement with or without @@ -85,3 +82,5 @@ private: //! Right operand CBotInstr* m_rightop; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotFieldExpr.cpp b/src/CBot/CBotInstr/CBotFieldExpr.cpp index cc7decfd..ae720af1 100644 --- a/src/CBot/CBotInstr/CBotFieldExpr.cpp +++ b/src/CBot/CBotInstr/CBotFieldExpr.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotFieldExpr.h" #include "CBot/CBotStack.h" @@ -26,11 +25,11 @@ #include "CBot/CBotVar/CBotVarClass.h" -// Local include - -// Global include #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotFieldExpr::CBotFieldExpr() { @@ -128,3 +127,5 @@ void CBotFieldExpr::RestoreStateVar(CBotStack* &pj, bool bMain) if (m_next3 != nullptr) m_next3->RestoreStateVar(pj, bMain); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotFieldExpr.h b/src/CBot/CBotInstr/CBotFieldExpr.h index 84c014fb..1c0d39da 100644 --- a/src/CBot/CBotInstr/CBotFieldExpr.h +++ b/src/CBot/CBotInstr/CBotFieldExpr.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotFieldExpr class Management of the fields of an instance @@ -81,3 +78,5 @@ private: friend class CBotExpression; int m_nIdent; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotFloat.cpp b/src/CBot/CBotInstr/CBotFloat.cpp index bc71f43b..dbf061df 100644 --- a/src/CBot/CBotInstr/CBotFloat.cpp +++ b/src/CBot/CBotInstr/CBotFloat.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotFloat.h" #include "CBot/CBotInstr/CBotLeftExprVar.h" #include "CBot/CBotInstr/CBotTwoOpExpr.h" @@ -28,10 +27,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotFloat::CBotFloat() @@ -174,3 +171,5 @@ void CBotFloat::RestoreState(CBotStack* &pj, bool bMain) if (m_next2b) m_next2b->RestoreState(pile, bMain); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotFloat.h b/src/CBot/CBotInstr/CBotFloat.h index fa1d6f66..9d333bcf 100644 --- a/src/CBot/CBotInstr/CBotFloat.h +++ b/src/CBot/CBotInstr/CBotFloat.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotFloat class Definition of a real/float variable int a, b = 12.4; @@ -74,3 +71,5 @@ private: //! A value to put, if there is. CBotInstr* m_expr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotFor.cpp b/src/CBot/CBotInstr/CBotFor.cpp index 78512f62..62f5ac9e 100644 --- a/src/CBot/CBotInstr/CBotFor.cpp +++ b/src/CBot/CBotInstr/CBotFor.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotFor.h" #include "CBot/CBotInstr/CBotListExpression.h" #include "CBot/CBotInstr/CBotBlock.h" @@ -26,9 +25,8 @@ #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotFor::CBotFor() @@ -212,3 +210,5 @@ void CBotFor :: RestoreState(CBotStack* &pj, bool bMain) return; } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotFor.h b/src/CBot/CBotInstr/CBotFor.h index 949b28c7..bed1fded 100644 --- a/src/CBot/CBotInstr/CBotFor.h +++ b/src/CBot/CBotInstr/CBotFor.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotFor class @@ -79,3 +76,5 @@ private: //! A label if there is std::string m_label; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotFunction.cpp b/src/CBot/CBotInstr/CBotFunction.cpp index c6bd8f47..f2855d01 100644 --- a/src/CBot/CBotInstr/CBotFunction.cpp +++ b/src/CBot/CBotInstr/CBotFunction.cpp @@ -17,8 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ - -// Modules inlcude #include "CBot/CBotInstr/CBotFunction.h" #include "CBot/CBotInstr/CBotInstrUtils.h" @@ -37,11 +35,10 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include #include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotFunction::CBotFunction() @@ -887,3 +884,5 @@ void CBotFunction::AddPublic(CBotFunction* func) { m_publicFunctions.insert(func); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotFunction.h b/src/CBot/CBotInstr/CBotFunction.h index 5547b68d..76b31b37 100644 --- a/src/CBot/CBotInstr/CBotFunction.h +++ b/src/CBot/CBotInstr/CBotFunction.h @@ -19,14 +19,12 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include #include +namespace CBot +{ /*! * \brief The CBotFunction class A function declaration. Compilation of various @@ -281,3 +279,5 @@ private: friend class CBotCStack; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotIString.cpp b/src/CBot/CBotInstr/CBotIString.cpp index 04220f8c..d01fab9c 100644 --- a/src/CBot/CBotInstr/CBotIString.cpp +++ b/src/CBot/CBotInstr/CBotIString.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotIString.h" #include "CBot/CBotInstr/CBotLeftExprVar.h" #include "CBot/CBotInstr/CBotTwoOpExpr.h" @@ -27,10 +26,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotIString::CBotIString() @@ -159,3 +156,5 @@ void CBotIString::RestoreState(CBotStack* &pj, bool bMain) if (m_next2b) m_next2b->RestoreState(pile, bMain); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotIString.h b/src/CBot/CBotInstr/CBotIString.h index 93fcfbdb..f6d3b630 100644 --- a/src/CBot/CBotInstr/CBotIString.h +++ b/src/CBot/CBotInstr/CBotIString.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotIString class Define a string variable eg : int a, b = "salut"; @@ -74,3 +71,5 @@ private: //! A value to put, if there is. CBotInstr* m_expr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotIf.cpp b/src/CBot/CBotInstr/CBotIf.cpp index 784b88f9..cdf0a7da 100644 --- a/src/CBot/CBotInstr/CBotIf.cpp +++ b/src/CBot/CBotInstr/CBotIf.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotIf.h" #include "CBot/CBotInstr/CBotBlock.h" #include "CBot/CBotInstr/CBotCondition.h" @@ -25,10 +24,8 @@ #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotIf::CBotIf() @@ -167,3 +164,4 @@ void CBotIf :: RestoreState(CBotStack* &pj, bool bMain) } } +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotIf.h b/src/CBot/CBotInstr/CBotIf.h index 41c533d9..b479fdea 100644 --- a/src/CBot/CBotInstr/CBotIf.h +++ b/src/CBot/CBotInstr/CBotIf.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotIf class Instruction if (condition) operation1 else operation2; @@ -75,3 +72,5 @@ private: //! Instruction CBotInstr* m_BlockElse; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotIndexExpr.cpp b/src/CBot/CBotInstr/CBotIndexExpr.cpp index 483b1a0e..1629c26d 100644 --- a/src/CBot/CBotInstr/CBotIndexExpr.cpp +++ b/src/CBot/CBotInstr/CBotIndexExpr.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotIndexExpr.h" #include "CBot/CBotStack.h" @@ -25,11 +24,11 @@ #include "CBot/CBotVar/CBotVarArray.h" -// Local include - -// Global include #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotIndexExpr::CBotIndexExpr() { @@ -118,3 +117,5 @@ void CBotIndexExpr::RestoreStateVar(CBotStack* &pile, bool bMain) if (m_next3) m_next3->RestoreStateVar(pile, bMain); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotIndexExpr.h b/src/CBot/CBotInstr/CBotIndexExpr.h index 89f39649..713a9d60 100644 --- a/src/CBot/CBotInstr/CBotIndexExpr.h +++ b/src/CBot/CBotInstr/CBotIndexExpr.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotIndexExpr class Index management for arrays @@ -79,3 +77,5 @@ private: friend class CBotLeftExpr; friend class CBotExprVar; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInstArray.cpp b/src/CBot/CBotInstr/CBotInstArray.cpp index c841dd87..455de837 100644 --- a/src/CBot/CBotInstr/CBotInstArray.cpp +++ b/src/CBot/CBotInstr/CBotInstArray.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotInstArray.h" #include "CBot/CBotInstr/CBotLeftExprVar.h" @@ -32,10 +31,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotInstArray::CBotInstArray() @@ -229,3 +226,5 @@ void CBotInstArray::RestoreState(CBotStack* &pj, bool bMain) if (m_next2b ) m_next2b->RestoreState( pile1, bMain); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInstArray.h b/src/CBot/CBotInstr/CBotInstArray.h index 217cab69..46ebc4d8 100644 --- a/src/CBot/CBotInstr/CBotInstArray.h +++ b/src/CBot/CBotInstr/CBotInstArray.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotInstArray class Definition of an array. @@ -80,3 +77,5 @@ private: CBotTypResult m_typevar; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInstr.cpp b/src/CBot/CBotInstr/CBotInstr.cpp index ade23886..e402275b 100644 --- a/src/CBot/CBotInstr/CBotInstr.cpp +++ b/src/CBot/CBotInstr/CBotInstr.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" #include "CBot/CBotInstr/CBotFor.h" @@ -42,12 +41,11 @@ #include "CBot/CBotClass.h" #include "CBot/CBotStack.h" - -// Local include - -// Global include #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// int CBotInstr::m_LoopLvl = 0; std::vector CBotInstr::m_labelLvl = std::vector(); @@ -361,3 +359,5 @@ CBotInstr* CBotInstr::CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypRes pStack->SetError(CBotErrNoTerminator, p->GetStart()); return nullptr; } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInstr.h b/src/CBot/CBotInstr/CBotInstr.h index ec010a5b..70a69b24 100644 --- a/src/CBot/CBotInstr/CBotInstr.h +++ b/src/CBot/CBotInstr/CBotInstr.h @@ -24,6 +24,9 @@ #include +namespace CBot +{ + /* for example, the following program int x[]; x[1] = 4; @@ -269,3 +272,5 @@ private: //! List of labels used. static std::vector m_labelLvl; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInstrCall.cpp b/src/CBot/CBotInstr/CBotInstrCall.cpp index 3ba666d2..da3512a6 100644 --- a/src/CBot/CBotInstr/CBotInstrCall.cpp +++ b/src/CBot/CBotInstr/CBotInstrCall.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBotInstrCall.h" #include "CBot/CBotInstr/CBotExpression.h" @@ -26,10 +25,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotInstrCall::CBotInstrCall() @@ -205,3 +202,5 @@ void CBotInstrCall::RestoreState(CBotStack* &pj, bool bMain) pile2->RestoreCall(m_nFuncIdent, GetToken(), ppVars); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInstrCall.h b/src/CBot/CBotInstr/CBotInstrCall.h index 2a35eeba..223d7772 100644 --- a/src/CBot/CBotInstr/CBotInstrCall.h +++ b/src/CBot/CBotInstr/CBotInstrCall.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotInstrCall class Calls of these functions. @@ -74,3 +71,5 @@ private: //! Id of a function. long m_nFuncIdent; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInstrMethode.cpp b/src/CBot/CBotInstr/CBotInstrMethode.cpp index 80edd546..3c891dea 100644 --- a/src/CBot/CBotInstr/CBotInstrMethode.cpp +++ b/src/CBot/CBotInstr/CBotInstrMethode.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotInstrMethode.h" #include "CBot/CBotInstr/CBotInstrUtils.h" @@ -28,10 +27,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotInstrMethode::CBotInstrMethode() @@ -279,3 +276,5 @@ bool CBotInstrMethode::Execute(CBotStack* &pj) return pj->Return(pile2); // release the entire stack } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInstrMethode.h b/src/CBot/CBotInstr/CBotInstrMethode.h index f6bb1abe..e78b4924 100644 --- a/src/CBot/CBotInstr/CBotInstrMethode.h +++ b/src/CBot/CBotInstr/CBotInstrMethode.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotInstrMethode class A call of method. Compile a method call. @@ -90,3 +87,5 @@ private: //! Name of the class. std::string m_ClassName; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInstrUtils.cpp b/src/CBot/CBotInstr/CBotInstrUtils.cpp index 48408834..b3c1f35c 100644 --- a/src/CBot/CBotInstr/CBotInstrUtils.cpp +++ b/src/CBot/CBotInstr/CBotInstrUtils.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotInstrUtils.h" #include "CBot/CBotToken.h" @@ -28,9 +27,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars) @@ -163,3 +161,5 @@ bool TypesCompatibles(const CBotTypResult& type1, const CBotTypResult& type2) } return true; } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInstrUtils.h b/src/CBot/CBotInstr/CBotInstrUtils.h index 4365aca6..4c5913f5 100644 --- a/src/CBot/CBotInstr/CBotInstrUtils.h +++ b/src/CBot/CBotInstr/CBotInstrUtils.h @@ -19,13 +19,9 @@ #pragma once -// Modules inlcude +namespace CBot +{ -// Local include - -// Global include - -// Forward declaration class CBotInstr; class CBotToken; class CBotCStack; @@ -59,3 +55,5 @@ bool TypeCompatible(CBotTypResult& type1, CBotTypResult& type2, int op = 0); * \return */ bool TypesCompatibles(const CBotTypResult& type1, const CBotTypResult& type2); + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInt.cpp b/src/CBot/CBotInstr/CBotInt.cpp index d26599f2..3cc7d9e6 100644 --- a/src/CBot/CBotInstr/CBotInt.cpp +++ b/src/CBot/CBotInstr/CBotInt.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotInt.h" #include "CBot/CBotInstr/CBotLeftExprVar.h" @@ -29,10 +28,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotInt::CBotInt() @@ -188,3 +185,5 @@ void CBotInt::RestoreState(CBotStack* &pj, bool bMain) if (m_next2b) m_next2b->RestoreState(pile, bMain); // other(s) definition(s) } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotInt.h b/src/CBot/CBotInstr/CBotInt.h index 4489b8b7..2dbe3be5 100644 --- a/src/CBot/CBotInstr/CBotInt.h +++ b/src/CBot/CBotInstr/CBotInt.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotInt class Definition of an integer variable @@ -76,3 +73,5 @@ private: //! A value to put, if there is. CBotInstr* m_expr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotLeftExpr.cpp b/src/CBot/CBotInstr/CBotLeftExpr.cpp index e1915180..02566010 100644 --- a/src/CBot/CBotInstr/CBotLeftExpr.cpp +++ b/src/CBot/CBotInstr/CBotLeftExpr.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotLeftExpr.h" #include "CBot/CBotInstr/CBotFieldExpr.h" #include "CBot/CBotInstr/CBotIndexExpr.h" @@ -29,10 +28,8 @@ #include "CBot/CBotVar/CBotVarArray.h" -// Local include - -// Global include - +namespace CBot +{ ////////////////////////////////////////////////////////////////////////////////////// CBotLeftExpr::CBotLeftExpr() @@ -243,3 +240,5 @@ void CBotLeftExpr::RestoreStateVar(CBotStack* &pile, bool bMain) if (m_next3 != nullptr) m_next3->RestoreStateVar(pile, bMain); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotLeftExpr.h b/src/CBot/CBotInstr/CBotLeftExpr.h index 9ac75d95..b99e7473 100644 --- a/src/CBot/CBotInstr/CBotLeftExpr.h +++ b/src/CBot/CBotInstr/CBotLeftExpr.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotLeftExpr class Accept the expressions that be to the left of @@ -99,3 +96,5 @@ public: private: long m_nIdent; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotLeftExprVar.cpp b/src/CBot/CBotInstr/CBotLeftExprVar.cpp index d5170159..c563bcd3 100644 --- a/src/CBot/CBotInstr/CBotLeftExprVar.cpp +++ b/src/CBot/CBotInstr/CBotLeftExprVar.cpp @@ -26,6 +26,9 @@ #include +namespace CBot +{ + CBotLeftExprVar::CBotLeftExprVar() { name = "CBotLeftExprVar"; @@ -76,3 +79,5 @@ void CBotLeftExprVar::RestoreState(CBotStack* &pj, bool bMain) var1->SetUniqNum(m_nIdent); // Restore the identifier } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotLeftExprVar.h b/src/CBot/CBotInstr/CBotLeftExprVar.h index e692a6f0..984aebbe 100644 --- a/src/CBot/CBotInstr/CBotLeftExprVar.h +++ b/src/CBot/CBotInstr/CBotLeftExprVar.h @@ -21,6 +21,8 @@ #include "CBot/CBotInstr/CBotInstr.h" +namespace CBot +{ /** * \brief Expression on the left side of an assignment @@ -55,3 +57,5 @@ public: //! Unique identifier of that variable long m_nIdent = 0; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotListArray.cpp b/src/CBot/CBotInstr/CBotListArray.cpp index a3b16c10..f40e9c47 100644 --- a/src/CBot/CBotInstr/CBotListArray.cpp +++ b/src/CBot/CBotInstr/CBotListArray.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotListArray.h" #include "CBot/CBotInstr/CBotInstrUtils.h" @@ -30,9 +29,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotListArray::CBotListArray() @@ -180,3 +178,5 @@ void CBotListArray::RestoreState(CBotStack* &pj, bool bMain) p->RestoreState(pile, bMain); // size calculation //interrupted! } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotListArray.h b/src/CBot/CBotInstr/CBotListArray.h index a5069a9e..33b0bd71 100644 --- a/src/CBot/CBotInstr/CBotListArray.h +++ b/src/CBot/CBotInstr/CBotListArray.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotListArray class Definition of a assignment list for a table @@ -74,3 +71,5 @@ private: //! An expression for an element others are linked with CBotInstr :: m_next3; CBotInstr* m_expr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotListExpression.cpp b/src/CBot/CBotInstr/CBotListExpression.cpp index 5f5d9141..363f21ed 100644 --- a/src/CBot/CBotInstr/CBotListExpression.cpp +++ b/src/CBot/CBotInstr/CBotListExpression.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotListExpression.h" #include "CBot/CBotInstr/CBotExpression.h" #include "CBot/CBotInstr/CBotIString.h" @@ -28,9 +27,8 @@ #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// /// Seeks a declaration of variable or expression @@ -129,3 +127,5 @@ void CBotListExpression::RestoreState(CBotStack* &pj, bool bMain) p->RestoreState(pile, bMain); } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotListExpression.h b/src/CBot/CBotInstr/CBotListExpression.h index 1b4ccae3..e559e0d4 100644 --- a/src/CBot/CBotInstr/CBotListExpression.h +++ b/src/CBot/CBotInstr/CBotListExpression.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotListExpression class. Compiles a list of expressions is used @@ -70,3 +68,5 @@ private: //! The first expression to be evaluated CBotInstr* m_Expr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotListInstr.cpp b/src/CBot/CBotInstr/CBotListInstr.cpp index a6988981..6eaa1bc5 100644 --- a/src/CBot/CBotInstr/CBotListInstr.cpp +++ b/src/CBot/CBotInstr/CBotListInstr.cpp @@ -17,16 +17,14 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotListInstr.h" #include "CBot/CBotInstr/CBotBlock.h" #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotListInstr::CBotListInstr() @@ -119,3 +117,5 @@ void CBotListInstr::RestoreState(CBotStack* &pj, bool bMain) if (p != nullptr) p->RestoreState(pile, true); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotListInstr.h b/src/CBot/CBotInstr/CBotListInstr.h index b3d43622..36234618 100644 --- a/src/CBot/CBotInstr/CBotListInstr.h +++ b/src/CBot/CBotInstr/CBotListInstr.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotListInstr class Compiles a list of instructions separated by @@ -72,3 +69,5 @@ private: //! Instructions to do. CBotInstr* m_Instr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotLogicExpr.cpp b/src/CBot/CBotInstr/CBotLogicExpr.cpp index 10e97822..22f2c23e 100644 --- a/src/CBot/CBotInstr/CBotLogicExpr.cpp +++ b/src/CBot/CBotInstr/CBotLogicExpr.cpp @@ -17,14 +17,12 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotLogicExpr.h" #include "CBot/CBotStack.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotLogicExpr::CBotLogicExpr() @@ -92,3 +90,4 @@ void CBotLogicExpr::RestoreState(CBotStack* &pStack, bool bMain) } } +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotLogicExpr.h b/src/CBot/CBotInstr/CBotLogicExpr.h index 33b65033..a1a0ec07 100644 --- a/src/CBot/CBotInstr/CBotLogicExpr.h +++ b/src/CBot/CBotInstr/CBotLogicExpr.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotLogicExpr class @@ -68,3 +65,5 @@ private: CBotInstr* m_op2; friend class CBotTwoOpExpr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotNew.cpp b/src/CBot/CBotInstr/CBotNew.cpp index a7446a91..ad981677 100644 --- a/src/CBot/CBotInstr/CBotNew.cpp +++ b/src/CBot/CBotInstr/CBotNew.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotNew.h" #include "CBot/CBotStack.h" @@ -28,11 +27,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotNew::CBotNew() @@ -247,3 +243,5 @@ void CBotNew::RestoreState(CBotStack* &pj, bool bMain) ppVars, pile2) ; // interrupt here! } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotNew.h b/src/CBot/CBotInstr/CBotNew.h index 8a69e61e..f1eaf27c 100644 --- a/src/CBot/CBotInstr/CBotNew.h +++ b/src/CBot/CBotInstr/CBotNew.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotNew class Compile an instruction "new". @@ -73,3 +70,5 @@ private: CBotToken m_vartoken; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotParExpr.cpp b/src/CBot/CBotInstr/CBotParExpr.cpp index 897e1b04..9be80123 100644 --- a/src/CBot/CBotInstr/CBotParExpr.cpp +++ b/src/CBot/CBotInstr/CBotParExpr.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotParExpr.h" #include "CBot/CBotInstr/CBotExprUnaire.h" #include "CBot/CBotInstr/CBotExprVar.h" @@ -36,10 +35,8 @@ #include "CBot/CBotCStack.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack) @@ -191,3 +188,5 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack) return pStack->Return(nullptr, pStk); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotParExpr.h b/src/CBot/CBotInstr/CBotParExpr.h index 992b7028..fb186b32 100644 --- a/src/CBot/CBotInstr/CBotParExpr.h +++ b/src/CBot/CBotInstr/CBotParExpr.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// // possibly an expression in parentheses ( ... ) @@ -60,3 +57,5 @@ public: */ static CBotInstr* Compile(CBotToken* &p, CBotCStack* pStack); }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotPostIncExpr.cpp b/src/CBot/CBotInstr/CBotPostIncExpr.cpp index b5adae5e..aecbd849 100644 --- a/src/CBot/CBotInstr/CBotPostIncExpr.cpp +++ b/src/CBot/CBotInstr/CBotPostIncExpr.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotPostIncExpr.h" #include "CBot/CBotInstr/CBotExprVar.h" @@ -25,10 +24,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotPostIncExpr::CBotPostIncExpr() @@ -88,3 +85,5 @@ void CBotPostIncExpr::RestoreState(CBotStack* &pj, bool bMain) if (pile1 != nullptr) pile1->RestoreStack(this); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotPostIncExpr.h b/src/CBot/CBotInstr/CBotPostIncExpr.h index cdc45b34..5ccf32b5 100644 --- a/src/CBot/CBotInstr/CBotPostIncExpr.h +++ b/src/CBot/CBotInstr/CBotPostIncExpr.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ ////////////////////////////////////////////////////////////////////////////////////// // Management of pre-and post increment / decrement @@ -67,3 +65,5 @@ private: CBotInstr* m_Instr; friend class CBotParExpr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotPreIncExpr.cpp b/src/CBot/CBotInstr/CBotPreIncExpr.cpp index 6f5f9091..e1bedf73 100644 --- a/src/CBot/CBotInstr/CBotPreIncExpr.cpp +++ b/src/CBot/CBotInstr/CBotPreIncExpr.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotPreIncExpr.h" #include "CBot/CBotInstr/CBotExprVar.h" @@ -25,9 +24,8 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotPreIncExpr::CBotPreIncExpr() @@ -95,3 +93,5 @@ void CBotPreIncExpr::RestoreState(CBotStack* &pj, bool bMain) m_Instr->RestoreState(pile, bMain); } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotPreIncExpr.h b/src/CBot/CBotInstr/CBotPreIncExpr.h index eb5d2a98..957c3c47 100644 --- a/src/CBot/CBotInstr/CBotPreIncExpr.h +++ b/src/CBot/CBotInstr/CBotPreIncExpr.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotPreIncExpr class Management of pre increment. There is no @@ -63,3 +60,5 @@ private: CBotInstr* m_Instr; friend class CBotParExpr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotReturn.cpp b/src/CBot/CBotInstr/CBotReturn.cpp index 30f7d492..51c9ba63 100644 --- a/src/CBot/CBotInstr/CBotReturn.cpp +++ b/src/CBot/CBotInstr/CBotReturn.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotReturn.h" #include "CBot/CBotInstr/CBotInstrUtils.h" @@ -27,10 +26,8 @@ #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotReturn::CBotReturn() @@ -114,3 +111,5 @@ void CBotReturn::RestoreState(CBotStack* &pj, bool bMain) return; } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotReturn.h b/src/CBot/CBotInstr/CBotReturn.h index e41240ec..cc64c26c 100644 --- a/src/CBot/CBotInstr/CBotReturn.h +++ b/src/CBot/CBotInstr/CBotReturn.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotReturn class. Return parameters @@ -70,3 +68,5 @@ private: CBotInstr *m_Instr; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotSwitch.cpp b/src/CBot/CBotInstr/CBotSwitch.cpp index 5f8f7dac..08108f3d 100644 --- a/src/CBot/CBotInstr/CBotSwitch.cpp +++ b/src/CBot/CBotInstr/CBotSwitch.cpp @@ -1,5 +1,3 @@ - - /* * This file is part of the Colobot: Gold Edition source code * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam @@ -19,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotSwitch.h" #include "CBot/CBotInstr/CBotCase.h" #include "CBot/CBotInstr/CBotBlock.h" @@ -28,10 +25,8 @@ #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotSwitch::CBotSwitch() @@ -218,3 +213,5 @@ void CBotSwitch :: RestoreState(CBotStack* &pj, bool bMain) return; } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotSwitch.h b/src/CBot/CBotInstr/CBotSwitch.h index f174161c..f22aa508 100644 --- a/src/CBot/CBotInstr/CBotSwitch.h +++ b/src/CBot/CBotInstr/CBotSwitch.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotSwitch class. Compiles instruction "switch" @@ -74,3 +71,5 @@ private: CBotInstr* m_Block; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotThrow.cpp b/src/CBot/CBotInstr/CBotThrow.cpp index 6393239f..d3a96324 100644 --- a/src/CBot/CBotInstr/CBotThrow.cpp +++ b/src/CBot/CBotInstr/CBotThrow.cpp @@ -17,17 +17,14 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotThrow.h" #include "CBot/CBotInstr/CBotExpression.h" #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotThrow::CBotThrow() @@ -101,3 +98,5 @@ void CBotThrow::RestoreState(CBotStack* &pj, bool bMain) return; } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotThrow.h b/src/CBot/CBotInstr/CBotThrow.h index 62e11fc4..257ffcf6 100644 --- a/src/CBot/CBotInstr/CBotThrow.h +++ b/src/CBot/CBotInstr/CBotThrow.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotThrow class Compiles instruction "throw". @@ -71,3 +68,5 @@ private: CBotInstr* m_Value; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotTry.cpp b/src/CBot/CBotInstr/CBotTry.cpp index 452abb96..a950e1a2 100644 --- a/src/CBot/CBotInstr/CBotTry.cpp +++ b/src/CBot/CBotInstr/CBotTry.cpp @@ -17,17 +17,15 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude -#include "CBotTry.h" +#include "CBot/CBotInstr/CBotTry.h" + #include "CBot/CBotInstr/CBotBlock.h" #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include - +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotTry::CBotTry() @@ -225,3 +223,5 @@ void CBotTry::RestoreState(CBotStack* &pj, bool bMain) return; } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotTry.h b/src/CBot/CBotInstr/CBotTry.h index 6777a710..39deebd1 100644 --- a/src/CBot/CBotInstr/CBotTry.h +++ b/src/CBot/CBotInstr/CBotTry.h @@ -17,15 +17,12 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotCatch.h" #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotTry class Compiles instruction "try" @@ -76,3 +73,5 @@ private: CBotInstr* m_FinalInst; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotTwoOpExpr.cpp b/src/CBot/CBotInstr/CBotTwoOpExpr.cpp index 2e3ec4e6..0d167449 100644 --- a/src/CBot/CBotInstr/CBotTwoOpExpr.cpp +++ b/src/CBot/CBotInstr/CBotTwoOpExpr.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotTwoOpExpr.h" #include "CBot/CBotInstr/CBotInstrUtils.h" @@ -31,11 +30,11 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotTwoOpExpr::CBotTwoOpExpr() { @@ -505,3 +504,5 @@ void CBotTwoOpExpr::RestoreState(CBotStack* &pStack, bool bMain) return; } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotTwoOpExpr.h b/src/CBot/CBotInstr/CBotTwoOpExpr.h index e9829647..f711a35b 100644 --- a/src/CBot/CBotInstr/CBotTwoOpExpr.h +++ b/src/CBot/CBotInstr/CBotTwoOpExpr.h @@ -19,13 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include - +namespace CBot +{ /*! * \brief The CBotTwoOpExpr class All operations with two operands. @@ -76,3 +73,5 @@ private: //! Right element CBotInstr* m_rightop; }; + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotWhile.cpp b/src/CBot/CBotInstr/CBotWhile.cpp index 99e120e6..a28f3fe9 100644 --- a/src/CBot/CBotInstr/CBotWhile.cpp +++ b/src/CBot/CBotInstr/CBotWhile.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotInstr/CBotWhile.h" #include "CBot/CBotInstr/CBotBlock.h" #include "CBot/CBotInstr/CBotCondition.h" @@ -25,9 +24,8 @@ #include "CBot/CBotStack.h" #include "CBot/CBotCStack.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotWhile::CBotWhile() @@ -151,3 +149,5 @@ void CBotWhile::RestoreState(CBotStack* &pj, bool bMain) return; } } + +} // namespace CBot diff --git a/src/CBot/CBotInstr/CBotWhile.h b/src/CBot/CBotInstr/CBotWhile.h index 8898413f..af3ab004 100644 --- a/src/CBot/CBotInstr/CBotWhile.h +++ b/src/CBot/CBotInstr/CBotWhile.h @@ -19,12 +19,10 @@ #pragma once -// Modules inlcude #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include +namespace CBot +{ /*! * \brief The CBotWhile class Compile an instruction "while". @@ -77,3 +75,5 @@ private: std::string m_label; }; + +} // namespace CBot diff --git a/src/CBot/CBotProgram.cpp b/src/CBot/CBotProgram.cpp index e0da567d..c52b3293 100644 --- a/src/CBot/CBotProgram.cpp +++ b/src/CBot/CBotProgram.cpp @@ -30,6 +30,9 @@ #include "CBot/stdlib/stdlib.h" +namespace CBot +{ + CBotExternalCallList* CBotProgram::m_externalCalls = new CBotExternalCallList(); CBotProgram::CBotProgram() @@ -143,7 +146,6 @@ bool CBotProgram::Compile(const std::string& program, std::vector& return (m_functions != nullptr); } -//////////////////////////////////////////////////////////////////////////////// bool CBotProgram::Start(const std::string& name) { Stop(); @@ -167,7 +169,6 @@ bool CBotProgram::Start(const std::string& name) return true; // we are ready for Run() } -//////////////////////////////////////////////////////////////////////////////// bool CBotProgram::GetPosition(const std::string& name, int& start, int& stop, CBotGet modestart, CBotGet modestop) { CBotFunction* p = m_functions; @@ -183,7 +184,6 @@ bool CBotProgram::GetPosition(const std::string& name, int& start, int& stop, CB return true; } -//////////////////////////////////////////////////////////////////////////////// bool CBotProgram::Run(void* pUser, int timer) { if (m_stack == nullptr || m_entryPoint == nullptr) @@ -221,7 +221,6 @@ bool CBotProgram::Run(void* pUser, int timer) return ok; } -//////////////////////////////////////////////////////////////////////////////// void CBotProgram::Stop() { m_stack->Delete(); @@ -240,7 +239,7 @@ bool CBotProgram::GetRunPos(std::string& functionName, int& start, int& end) return true; } -//////////////////////////////////////////////////////////////////////////////// + CBotVar* CBotProgram::GetStackVars(std::string& functionName, int level) { functionName.clear(); @@ -261,7 +260,7 @@ CBotError CBotProgram::GetError() return m_error; } -//////////////////////////////////////////////////////////////////////////////// + bool CBotProgram::GetError(CBotError& code, int& start, int& end) { code = m_error; @@ -270,7 +269,7 @@ bool CBotProgram::GetError(CBotError& code, int& start, int& end) return code > 0; } -//////////////////////////////////////////////////////////////////////////////// + bool CBotProgram::GetError(CBotError& code, int& start, int& end, CBotProgram*& pProg) { code = m_error; @@ -287,14 +286,14 @@ CBotFunction* CBotProgram::GetFunctions() } //////////////////////////////////////////////////////////////////////////////// -bool CBotProgram::AddFunction(const std::string& name, - bool rExec(CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser), - CBotTypResult rCompile(CBotVar*& pVar, void* pUser)) +CBotTypResult cSizeOf( CBotVar* &pVar, void* pUser ) { - return m_externalCalls->AddFunction(name, std::unique_ptr(new CBotExternalCallDefault(rExec, rCompile))); + if ( pVar == nullptr ) return CBotTypResult( CBotErrLowParam ); + if ( pVar->GetType() != CBotTypArrayPointer ) + return CBotTypResult( CBotErrBadParam ); + return CBotTypResult( CBotTypInt ); } -//////////////////////////////////////////////////////////////////////////////// bool rSizeOf( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) { if ( pVar == nullptr ) return CBotErrLowParam; @@ -313,15 +312,13 @@ bool rSizeOf( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) } //////////////////////////////////////////////////////////////////////////////// -CBotTypResult cSizeOf( CBotVar* &pVar, void* pUser ) +bool CBotProgram::AddFunction(const std::string& name, + bool rExec(CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser), + CBotTypResult rCompile(CBotVar*& pVar, void* pUser)) { - if ( pVar == nullptr ) return CBotTypResult( CBotErrLowParam ); - if ( pVar->GetType() != CBotTypArrayPointer ) - return CBotTypResult( CBotErrBadParam ); - return CBotTypResult( CBotTypInt ); + return m_externalCalls->AddFunction(name, std::unique_ptr(new CBotExternalCallDefault(rExec, rCompile))); } -//////////////////////////////////////////////////////////////////////////////// bool CBotProgram::DefineNum(const std::string& name, long val) { CBotToken::DefineNum(name, val); @@ -347,7 +344,6 @@ bool CBotProgram::SaveState(FILE* pf) return true; } -//////////////////////////////////////////////////////////////////////////////// bool CBotProgram::RestoreState(FILE* pf) { unsigned short w; @@ -378,12 +374,12 @@ bool CBotProgram::RestoreState(FILE* pf) } //////////////////////////////////////////////////////////////////////////////// + int CBotProgram::GetVersion() { return CBOTVERSION; } -//////////////////////////////////////////////////////////////////////////////// void CBotProgram::Init() { CBotProgram::DefineNum("CBotErrZeroDiv", CBotErrZeroDiv); // division by zero @@ -406,7 +402,6 @@ void CBotProgram::Init() InitFileFunctions(); } -//////////////////////////////////////////////////////////////////////////////// void CBotProgram::Free() { CBotToken::ClearDefineNum(); @@ -418,3 +413,5 @@ CBotExternalCallList* CBotProgram::GetExternalCalls() { return m_externalCalls; } + +} // namespace CBot diff --git a/src/CBot/CBotProgram.h b/src/CBot/CBotProgram.h index c8aaa0a4..cb163019 100644 --- a/src/CBot/CBotProgram.h +++ b/src/CBot/CBotProgram.h @@ -24,6 +24,9 @@ #include +namespace CBot +{ + class CBotFunction; class CBotClass; class CBotStack; @@ -360,3 +363,5 @@ private: int m_errorStart = 0; int m_errorEnd = 0; }; + +} // namespace CBot diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp index e9144595..83babb85 100644 --- a/src/CBot/CBotStack.cpp +++ b/src/CBot/CBotStack.cpp @@ -33,6 +33,9 @@ #include +namespace CBot +{ + #define ITIMER 100 int CBotStack::m_initimer = ITIMER; @@ -925,3 +928,5 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar) } return true; } + +} // namespace CBot diff --git a/src/CBot/CBotStack.h b/src/CBot/CBotStack.h index 7438518c..ede289da 100644 --- a/src/CBot/CBotStack.h +++ b/src/CBot/CBotStack.h @@ -21,11 +21,14 @@ #include "CBot/CBotDefines.h" #include "CBot/CBotTypResult.h" -#include "CBotEnums.h" +#include "CBot/CBotEnums.h" +#include "CBot/CBotVar/CBotVar.h" #include #include -#include + +namespace CBot +{ class CBotInstr; class CBotExternalCall; @@ -495,3 +498,5 @@ private: CBotExternalCall* m_call; // recovery point in a extern call friend class CBotTry; }; + +} // namespace CBot diff --git a/src/CBot/CBotToken.cpp b/src/CBot/CBotToken.cpp index cec1bedf..aff8431b 100644 --- a/src/CBot/CBotToken.cpp +++ b/src/CBot/CBotToken.cpp @@ -22,6 +22,9 @@ #include #include +namespace CBot +{ + //! \brief Keeps the string corresponding to keyword ID //! Map is filled with id-string pars that are needed for CBot language parsing static const std::map KEYWORDS = { @@ -511,3 +514,5 @@ bool IsOfTypeList(CBotToken* &p, int type1, ...) } } } + +} // namespace CBot diff --git a/src/CBot/CBotToken.h b/src/CBot/CBotToken.h index 22f9bd0a..cd5d0980 100644 --- a/src/CBot/CBotToken.h +++ b/src/CBot/CBotToken.h @@ -27,6 +27,9 @@ #include #include +namespace CBot +{ + /** * \brief Class representing one token of a program. * @@ -244,3 +247,5 @@ extern bool IsOfTypeList(CBotToken* &p, int type1, ...); * \return String if found, empty string otherwise */ const std::string& LoadString(TokenId id); + +} // namespace CBot diff --git a/src/CBot/CBotTypResult.cpp b/src/CBot/CBotTypResult.cpp index 554b66b8..e20db63f 100644 --- a/src/CBot/CBotTypResult.cpp +++ b/src/CBot/CBotTypResult.cpp @@ -17,23 +17,16 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotTypResult.h" #include "CBot/CBotEnums.h" #include "CBot/CBotClass.h" -// Local include -// Global include +namespace CBot +{ - - -/////////////////////////////////////////////////////// -// management of results types - -//////////////////////////////////////////////////////////////////////////////// CBotTypResult::CBotTypResult(int type) { m_type = type; @@ -42,7 +35,6 @@ CBotTypResult::CBotTypResult(int type) m_limite = -1; } -//////////////////////////////////////////////////////////////////////////////// CBotTypResult::CBotTypResult(int type, const std::string& name) { m_type = type; @@ -59,7 +51,6 @@ CBotTypResult::CBotTypResult(int type, const std::string& name) } } -//////////////////////////////////////////////////////////////////////////////// CBotTypResult::CBotTypResult(int type, CBotClass* pClass) { m_type = type; @@ -70,7 +61,6 @@ CBotTypResult::CBotTypResult(int type, CBotClass* pClass) if ( m_pClass && m_pClass->IsIntrinsic() ) m_type = CBotTypIntrinsic; } -//////////////////////////////////////////////////////////////////////////////// CBotTypResult::CBotTypResult(int type, CBotTypResult elem) { m_type = type; @@ -83,7 +73,6 @@ CBotTypResult::CBotTypResult(int type, CBotTypResult elem) m_pNext = new CBotTypResult( elem ); } -//////////////////////////////////////////////////////////////////////////////// CBotTypResult::CBotTypResult(const CBotTypResult& typ) { m_type = typ.m_type; @@ -95,7 +84,6 @@ CBotTypResult::CBotTypResult(const CBotTypResult& typ) m_pNext = new CBotTypResult( *typ.m_pNext ); } -//////////////////////////////////////////////////////////////////////////////// CBotTypResult::CBotTypResult() { m_type = 0; @@ -104,50 +92,42 @@ CBotTypResult::CBotTypResult() m_pClass = nullptr; } -//////////////////////////////////////////////////////////////////////////////// CBotTypResult::~CBotTypResult() { delete m_pNext; } -//////////////////////////////////////////////////////////////////////////////// int CBotTypResult::GetType(int mode) const { if ( mode == 3 && m_type == CBotTypNullPointer ) return CBotTypPointer; return m_type; } -//////////////////////////////////////////////////////////////////////////////// void CBotTypResult::SetType(int n) { m_type = n; } -//////////////////////////////////////////////////////////////////////////////// CBotClass* CBotTypResult::GetClass() const { return m_pClass; } -//////////////////////////////////////////////////////////////////////////////// CBotTypResult& CBotTypResult::GetTypElem() const { return *m_pNext; } -//////////////////////////////////////////////////////////////////////////////// int CBotTypResult::GetLimite() const { return m_limite; } -//////////////////////////////////////////////////////////////////////////////// void CBotTypResult::SetLimite(int n) { m_limite = n; } -//////////////////////////////////////////////////////////////////////////////// void CBotTypResult::SetArray( int* max ) { m_limite = *max; @@ -159,7 +139,6 @@ void CBotTypResult::SetArray( int* max ) } } -//////////////////////////////////////////////////////////////////////////////// bool CBotTypResult::Compare(const CBotTypResult& typ) const { if ( m_type != typ.m_type ) return false; @@ -176,13 +155,11 @@ bool CBotTypResult::Compare(const CBotTypResult& typ) const return true; } -//////////////////////////////////////////////////////////////////////////////// bool CBotTypResult::Eq(int type) const { return m_type == type; } -//////////////////////////////////////////////////////////////////////////////// CBotTypResult& CBotTypResult::operator=(const CBotTypResult& src) { m_type = src.m_type; @@ -195,3 +172,5 @@ CBotTypResult& CBotTypResult::operator=(const CBotTypResult& src) } return *this; } + +} // namespace CBot diff --git a/src/CBot/CBotTypResult.h b/src/CBot/CBotTypResult.h index 98aeeeb5..6a211f03 100644 --- a/src/CBot/CBotTypResult.h +++ b/src/CBot/CBotTypResult.h @@ -21,6 +21,9 @@ #include +namespace CBot +{ + class CBotClass; /** @@ -157,3 +160,5 @@ private: friend class CBotVarClass; friend class CBotVarPointer; }; + +} // namespace CBot diff --git a/src/CBot/CBotUtils.cpp b/src/CBot/CBotUtils.cpp index fe51f7f7..10f7f53f 100644 --- a/src/CBot/CBotUtils.cpp +++ b/src/CBot/CBotUtils.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotUtils.h" #include "CBot/CBotToken.h" @@ -27,11 +26,11 @@ #include "CBot/CBotVar/CBotVar.h" -// Local include - -// Global include #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotVar* MakeListVars(CBotVar** ppVars, bool bSetVal) { @@ -236,3 +235,5 @@ float GetNumFloat(const std::string& str) if (bNeg) num = -num; return static_cast(num); } + +} // namespace CBot diff --git a/src/CBot/CBotUtils.h b/src/CBot/CBotUtils.h index 259b0342..a56a646b 100644 --- a/src/CBot/CBotUtils.h +++ b/src/CBot/CBotUtils.h @@ -25,7 +25,9 @@ #include #include -// Forward declaration +namespace CBot +{ + class CBotVar; class CBotToken; class CBotCStack; @@ -82,14 +84,14 @@ bool WriteFloat(FILE* pf, float w); /*! * \brief GetNumInt Converts a string into integer may be of the form 0xabc123. - * \param p + * \param str * \return */ -long GetNumInt(const std::string& p); +long GetNumInt(const std::string& str); /*! * \brief GetNumFloat Converts a string into a float number. - * \param p + * \param str * \return */ float GetNumFloat(const std::string& str); @@ -182,4 +184,6 @@ public: protected: T* m_next = nullptr; T* m_prev = nullptr; -}; \ No newline at end of file +}; + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVar.cpp b/src/CBot/CBotVar/CBotVar.cpp index 460a0f28..a82598bf 100644 --- a/src/CBot/CBotVar/CBotVar.cpp +++ b/src/CBot/CBotVar/CBotVar.cpp @@ -18,7 +18,6 @@ */ -// Modules inlcude #include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotStack.h" @@ -36,14 +35,15 @@ #include "CBot/CBotEnums.h" -// Local include - -// Global include #include #include #include #include + +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// long CBotVar::m_identcpt = 0; @@ -728,3 +728,5 @@ CBotClass* CBotVar::GetClass() assert(0); return nullptr; } + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVar.h b/src/CBot/CBotVar/CBotVar.h index ec177e0d..2bb3b501 100644 --- a/src/CBot/CBotVar/CBotVar.h +++ b/src/CBot/CBotVar/CBotVar.h @@ -26,6 +26,9 @@ #include +namespace CBot +{ + class CBotVarClass; class CBotInstr; class CBotClass; @@ -671,3 +674,5 @@ protected: friend class CBotVarPointer; friend class CBotVarArray; }; + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarArray.cpp b/src/CBot/CBotVar/CBotVarArray.cpp index 3c99b978..dd440726 100644 --- a/src/CBot/CBotVar/CBotVarArray.cpp +++ b/src/CBot/CBotVar/CBotVarArray.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotVar/CBotVarArray.h" #include "CBot/CBotVar/CBotVarClass.h" #include "CBot/CBotToken.h" @@ -25,11 +24,12 @@ #include "CBot/CBotEnums.h" -// Local include - -// Global include #include + +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotVarArray::CBotVarArray(const CBotToken& name, CBotTypResult& type) { @@ -143,3 +143,5 @@ bool CBotVarArray::Save1State(FILE* pf) if ( !WriteType(pf, m_type) ) return false; return SaveVar(pf, m_pInstance); // saves the instance that manages the table } + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarArray.h b/src/CBot/CBotVar/CBotVarArray.h index 76a18106..317fa276 100644 --- a/src/CBot/CBotVar/CBotVarArray.h +++ b/src/CBot/CBotVar/CBotVarArray.h @@ -21,6 +21,9 @@ #include "CBot/CBotVar/CBotVar.h" +namespace CBot +{ + /** * \brief CBotVar subclass for managing arrays (::CBotTypArrayPointer) * @@ -54,3 +57,5 @@ private: //! Array data CBotVarClass* m_pInstance; }; + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarBoolean.cpp b/src/CBot/CBotVar/CBotVarBoolean.cpp index 57de0f07..857a6645 100644 --- a/src/CBot/CBotVar/CBotVarBoolean.cpp +++ b/src/CBot/CBotVar/CBotVarBoolean.cpp @@ -25,6 +25,9 @@ #include "CBot/CBotToken.h" +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotVarBoolean::CBotVarBoolean(const CBotToken& name) { @@ -151,3 +154,5 @@ bool CBotVarBoolean::Save1State(FILE* pf) { return WriteWord(pf, m_val); // the value of the variable } + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarBoolean.h b/src/CBot/CBotVar/CBotVarBoolean.h index 965ff0fb..b46bd4da 100644 --- a/src/CBot/CBotVar/CBotVarBoolean.h +++ b/src/CBot/CBotVar/CBotVarBoolean.h @@ -21,6 +21,9 @@ #include "CBot/CBotVar/CBotVar.h" +namespace CBot +{ + /** * \brief CBotVar subclass for managing boolean values (::CBotTypBoolean) */ @@ -54,3 +57,5 @@ private: //! The value. bool m_val; }; + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarClass.cpp b/src/CBot/CBotVar/CBotVarClass.cpp index f7caeb2e..f3307d08 100644 --- a/src/CBot/CBotVar/CBotVarClass.cpp +++ b/src/CBot/CBotVar/CBotVarClass.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotVar/CBotVarClass.h" #include "CBot/CBotClass.h" @@ -28,11 +27,11 @@ #include "CBot/CBotInstr/CBotInstr.h" -// Local include - -// Global include #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotVarClass* CBotVarClass::m_ExClass = nullptr; @@ -495,3 +494,5 @@ bool CBotVarClass::Save1State(FILE* pf) return SaveVar(pf, m_pVar); // content of the object } + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarClass.h b/src/CBot/CBotVar/CBotVarClass.h index 2f8a236a..7749170e 100644 --- a/src/CBot/CBotVar/CBotVarClass.h +++ b/src/CBot/CBotVar/CBotVarClass.h @@ -21,6 +21,9 @@ #include "CBot/CBotVar/CBotVar.h" +namespace CBot +{ + /** * \brief CBotVar subclass for managing classes (::CBotTypClass, ::CBotTypIntrinsic) * @@ -112,3 +115,5 @@ private: friend class CBotVar; friend class CBotVarPointer; }; + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarFloat.cpp b/src/CBot/CBotVar/CBotVarFloat.cpp index 60b8afdc..b48297d4 100644 --- a/src/CBot/CBotVar/CBotVarFloat.cpp +++ b/src/CBot/CBotVar/CBotVarFloat.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotVar/CBotVarFloat.h" #include "CBot/CBotEnums.h" @@ -25,11 +24,11 @@ #include "CBot/CBotUtils.h" -// Local include - -// Global include #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotVarFloat::CBotVarFloat(const CBotToken& name) { @@ -223,3 +222,5 @@ bool CBotVarFloat::Save1State(FILE* pf) { return WriteFloat(pf, m_val); // the value of the variable } + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarFloat.h b/src/CBot/CBotVar/CBotVarFloat.h index 5b44a3be..4e202c90 100644 --- a/src/CBot/CBotVar/CBotVarFloat.h +++ b/src/CBot/CBotVar/CBotVarFloat.h @@ -21,6 +21,9 @@ #include "CBot/CBotVar/CBotVar.h" +namespace CBot +{ + /** * \brief CBotVar subclass for managing float values (::CBotTypFloat) */ @@ -64,3 +67,5 @@ private: //! The value. float m_val; }; + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarInt.cpp b/src/CBot/CBotVar/CBotVarInt.cpp index a36f84ee..2718206e 100644 --- a/src/CBot/CBotVar/CBotVarInt.cpp +++ b/src/CBot/CBotVar/CBotVarInt.cpp @@ -17,18 +17,17 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotVar/CBotVarInt.h" #include "CBot/CBotEnums.h" #include "CBot/CBotToken.h" #include "CBot/CBotUtils.h" -// Local include - -// Global include #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotVarInt::CBotVarInt(const CBotToken& name) { @@ -291,3 +290,5 @@ bool CBotVarInt::Save1State(FILE* pf) { return WriteWord(pf, m_val); // the value of the variable } + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarInt.h b/src/CBot/CBotVar/CBotVarInt.h index 56f9c68b..6b7e74d7 100644 --- a/src/CBot/CBotVar/CBotVarInt.h +++ b/src/CBot/CBotVar/CBotVarInt.h @@ -21,6 +21,9 @@ #include "CBot/CBotVar/CBotVar.h" +namespace CBot +{ + /** * \brief CBotVar subclass for managing integer values (::CBotTypInt) */ @@ -77,3 +80,5 @@ private: std::string m_defnum; friend class CBotVar; }; + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarPointer.cpp b/src/CBot/CBotVar/CBotVarPointer.cpp index 2d98506c..fd8e1a25 100644 --- a/src/CBot/CBotVar/CBotVarPointer.cpp +++ b/src/CBot/CBotVar/CBotVarPointer.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotVar/CBotVarPointer.h" #include "CBot/CBotToken.h" #include "CBot/CBotClass.h" @@ -27,11 +26,11 @@ #include "CBot/CBotUtils.h" #include "CBot/CBotFileUtils.h" -// Local include - -// Global include #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// CBotVarPointer::CBotVarPointer(const CBotToken& name, CBotTypResult& type) { @@ -244,3 +243,5 @@ bool CBotVarPointer::Ne(CBotVar* left, CBotVar* right) if ( r == nullptr && l->GetUserPtr() == OBJECTDELETED ) return false; return true; } + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarPointer.h b/src/CBot/CBotVar/CBotVarPointer.h index 6eb8d4e6..ea3168b9 100644 --- a/src/CBot/CBotVar/CBotVarPointer.h +++ b/src/CBot/CBotVar/CBotVarPointer.h @@ -21,6 +21,9 @@ #include "CBot/CBotVar/CBotVar.h" +namespace CBot +{ + /** * \brief CBotVar subclass for managing pointers to classes (::CBotTypPointer) */ @@ -72,3 +75,5 @@ private: CBotClass* m_pClass; friend class CBotVar; }; + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarString.cpp b/src/CBot/CBotVar/CBotVarString.cpp index dc942c5d..2f5b9ff0 100644 --- a/src/CBot/CBotVar/CBotVarString.cpp +++ b/src/CBot/CBotVar/CBotVarString.cpp @@ -17,16 +17,14 @@ * along with this program. If not, see http://gnu.org/licenses */ -// Modules inlcude #include "CBot/CBotVar/CBotVarString.h" #include "CBot/CBotEnums.h" #include "CBot/CBotToken.h" #include "CBot/CBotUtils.h" -// Local include - -// Global include +namespace CBot +{ //////////////////////////////////////////////////////////////////////////////// CBotVarString::CBotVarString(const CBotToken& name) @@ -133,3 +131,5 @@ bool CBotVarString::Save1State(FILE* pf) { return WriteString(pf, m_val); // the value of the variable } + +} // namespace CBot diff --git a/src/CBot/CBotVar/CBotVarString.h b/src/CBot/CBotVar/CBotVarString.h index ad24a106..ebe6380a 100644 --- a/src/CBot/CBotVar/CBotVarString.h +++ b/src/CBot/CBotVar/CBotVarString.h @@ -21,6 +21,9 @@ #include "CBot/CBotVar/CBotVar.h" +namespace CBot +{ + /** * \brief CBotVar subclass for managing string values (::CBotTypString) */ @@ -52,3 +55,5 @@ private: //! The value. std::string m_val; }; + +} // namespace CBot diff --git a/src/CBot/README.txt b/src/CBot/README.txt index f6dcb5fb..eaa94603 100644 --- a/src/CBot/README.txt +++ b/src/CBot/README.txt @@ -1,4 +1,9 @@ /** * \dir src/CBot * \brief CBot library + */ + +/** + * \namespace CBot + * \brief CBot engine */ \ No newline at end of file diff --git a/src/CBot/stdlib/Compilation.cpp b/src/CBot/stdlib/Compilation.cpp index e0f3c500..9068a57b 100644 --- a/src/CBot/stdlib/Compilation.cpp +++ b/src/CBot/stdlib/Compilation.cpp @@ -21,6 +21,9 @@ #include "CBot/CBot.h" +namespace CBot +{ + // Compiling a procedure without any parameters. CBotTypResult cNull(CBotVar* &var, void* user) @@ -233,4 +236,6 @@ CBotTypResult cIntStr(CBotVar*& var, void* user) // the end result is an integer return CBotTypResult( CBotTypInt ); -} \ No newline at end of file +} + +} // namespace CBot diff --git a/src/CBot/stdlib/Compilation.h b/src/CBot/stdlib/Compilation.h index 0b4014d5..52030814 100644 --- a/src/CBot/stdlib/Compilation.h +++ b/src/CBot/stdlib/Compilation.h @@ -21,6 +21,9 @@ #include "CBot/CBotTypResult.h" +namespace CBot +{ + class CBotVar; // Commonly used functions for parameter compilation @@ -53,4 +56,6 @@ CBotTypResult cStrStrIntInt(CBotVar*& var, void* user); // string foo(string, number) CBotTypResult cStrStrInt(CBotVar*& var, void* user); // int foo(string) -CBotTypResult cIntStr(CBotVar*& var, void* user); \ No newline at end of file +CBotTypResult cIntStr(CBotVar*& var, void* user); + +} // namespace CBot diff --git a/src/CBot/stdlib/FileFunctions.cpp b/src/CBot/stdlib/FileFunctions.cpp index 98618411..ebc52e6d 100644 --- a/src/CBot/stdlib/FileFunctions.cpp +++ b/src/CBot/stdlib/FileFunctions.cpp @@ -25,6 +25,9 @@ #include #include +namespace CBot +{ + namespace { std::unique_ptr g_fileHandler; std::unordered_map> g_files; @@ -391,4 +394,6 @@ void InitFileFunctions() void SetFileAccessHandler(std::unique_ptr fileHandler) { g_fileHandler = std::move(fileHandler); -} \ No newline at end of file +} + +} // namespace CBot diff --git a/src/CBot/stdlib/MathFunctions.cpp b/src/CBot/stdlib/MathFunctions.cpp index 483c0786..daa02c15 100644 --- a/src/CBot/stdlib/MathFunctions.cpp +++ b/src/CBot/stdlib/MathFunctions.cpp @@ -22,6 +22,9 @@ #include "CBot/CBot.h" #include + +namespace CBot +{ const float PI = 3.14159265358979323846f; // Instruction "sin(degrees)". @@ -206,4 +209,6 @@ void InitMathFunctions() CBotProgram::AddFunction("ceil", rCeil, cOneFloat); CBotProgram::AddFunction("round", rRound, cOneFloat); CBotProgram::AddFunction("trunc", rTrunc, cOneFloat); -} \ No newline at end of file +} + +} // namespace CBot diff --git a/src/CBot/stdlib/StringFunctions.cpp b/src/CBot/stdlib/StringFunctions.cpp index 324db49d..f4ac5e8b 100644 --- a/src/CBot/stdlib/StringFunctions.cpp +++ b/src/CBot/stdlib/StringFunctions.cpp @@ -25,6 +25,9 @@ #include +namespace CBot +{ + //////////////////////////////////////////////////////////////////////////////// bool rStrLen( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) { @@ -278,3 +281,4 @@ void InitStringFunctions() CBotProgram::AddFunction("strlower", rStrLower, cStrStr ); } +} // namespace CBot diff --git a/src/CBot/stdlib/stdlib.h b/src/CBot/stdlib/stdlib.h index 52d72619..e96da2d6 100644 --- a/src/CBot/stdlib/stdlib.h +++ b/src/CBot/stdlib/stdlib.h @@ -21,6 +21,11 @@ #include "CBot/stdlib/stdlib_public.h" +namespace CBot +{ + void InitStringFunctions(); void InitFileFunctions(); -void InitMathFunctions(); \ No newline at end of file +void InitMathFunctions(); + +} // namespace CBot diff --git a/src/CBot/stdlib/stdlib_public.h b/src/CBot/stdlib/stdlib_public.h index c8f643e9..b78e7641 100644 --- a/src/CBot/stdlib/stdlib_public.h +++ b/src/CBot/stdlib/stdlib_public.h @@ -23,6 +23,9 @@ #include +namespace CBot +{ + class CBotFile { public: @@ -50,4 +53,6 @@ public: void SetFileAccessHandler(std::unique_ptr fileHandler); -// TODO: provide default implementation of CBotFileAccessHandler \ No newline at end of file +// TODO: provide default implementation of CBotFileAccessHandler + +} // namespace CBot diff --git a/src/common/restext.cpp b/src/common/restext.cpp index 8ef7716c..1427a1bf 100644 --- a/src/common/restext.cpp +++ b/src/common/restext.cpp @@ -41,7 +41,7 @@ const char* stringsText[RT_MAX] = { nullptr }; const char* stringsEvent[EVENT_STD_MAX] = { nullptr }; const char* stringsObject[OBJECT_MAX] = { nullptr }; const char* stringsErr[ERR_MAX] = { nullptr }; -const char* stringsCbot[TX_MAX] = { nullptr }; +const char* stringsCbot[CBot::CBotErrMAX] = { nullptr }; /* Macro to mark which texts are translatable by gettext * It doesn't do anything at compile-time, as all texts represented here are used later @@ -670,66 +670,66 @@ void InitializeRestext() - stringsCbot[CBotErrOpenPar] = TR("Opening bracket missing"); - stringsCbot[CBotErrClosePar] = TR("Closing bracket missing "); - stringsCbot[CBotErrNotBoolean] = TR("The expression must return a boolean value"); - stringsCbot[CBotErrUndefVar] = TR("Variable not declared"); - stringsCbot[CBotErrBadLeft] = TR("Assignment impossible"); - stringsCbot[CBotErrNoTerminator] = TR("Semicolon terminator missing"); - stringsCbot[CBotErrCaseOut] = TR("Instruction \"case\" outside a block \"switch\""); - stringsCbot[CBotErrNoEnd] = TR("Instructions after the final closing brace"); - stringsCbot[CBotErrCloseBlock] = TR("End of block missing"); - stringsCbot[CBotErrElseWhitoutIf] = TR("Instruction \"else\" without corresponding \"if\" "); - stringsCbot[CBotErrOpenBlock] = TR("Opening brace missing "); - stringsCbot[CBotErrBadType1] = TR("Wrong type for the assignment"); - stringsCbot[CBotErrRedefVar] = TR("A variable can not be declared twice"); - stringsCbot[CBotErrBadType2] = TR("The types of the two operands are incompatible "); - stringsCbot[CBotErrUndefCall] = TR("Unknown function"); - stringsCbot[CBotErrNoDoubleDots] = TR("Sign \" : \" missing"); - stringsCbot[CBotErrNoWhile] = TR("Keyword \"while\" missing"); - stringsCbot[CBotErrBreakOutside] = TR("Instruction \"break\" outside a loop"); - stringsCbot[CBotErrLabel] = TR("A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\""); - stringsCbot[CBotErrUndefLabel] = TR("This label does not exist"); - stringsCbot[CBotErrNoCase] = TR("Instruction \"case\" missing"); - stringsCbot[CBotErrBadNum] = TR("Number missing"); - stringsCbot[CBotErrVoid] = TR("Void parameter"); - stringsCbot[CBotErrNoType] = TR("Type declaration missing"); - stringsCbot[CBotErrNoVar] = TR("Variable name missing"); - stringsCbot[CBotErrNoFunc] = TR("Function name missing"); - stringsCbot[CBotErrOverParam] = TR("Too many parameters"); - stringsCbot[CBotErrRedefFunc] = TR("Function already exists"); - stringsCbot[CBotErrLowParam] = TR("Parameters missing "); - stringsCbot[CBotErrBadParam] = TR("No function with this name accepts this kind of parameter"); - stringsCbot[CBotErrNbParam] = TR("No function with this name accepts this number of parameters"); - stringsCbot[CBotErrUndefItem] = TR("This is not a member of this class"); - stringsCbot[CBotErrUndefClass] = TR("This object is not a member of a class"); - stringsCbot[CBotErrNoConstruct] = TR("Appropriate constructor missing"); - stringsCbot[CBotErrRedefClass] = TR("This class already exists"); - stringsCbot[CBotErrCloseIndex] = TR("\" ] \" missing"); - stringsCbot[CBotErrReserved] = TR("Reserved keyword of CBOT language"); - stringsCbot[CBotErrBadNew] = TR("Bad argument for \"new\""); - stringsCbot[CBotErrOpenIndex] = TR("\" [ \" expected"); - stringsCbot[CBotErrBadString] = TR("String missing"); - stringsCbot[CBotErrBadIndex] = TR("Incorrect index type"); - stringsCbot[CBotErrPrivate] = TR("Private element"); - stringsCbot[CBotErrNoPublic] = TR("Public required"); + stringsCbot[CBot::CBotErrOpenPar] = TR("Opening bracket missing"); + stringsCbot[CBot::CBotErrClosePar] = TR("Closing bracket missing "); + stringsCbot[CBot::CBotErrNotBoolean] = TR("The expression must return a boolean value"); + stringsCbot[CBot::CBotErrUndefVar] = TR("Variable not declared"); + stringsCbot[CBot::CBotErrBadLeft] = TR("Assignment impossible"); + stringsCbot[CBot::CBotErrNoTerminator] = TR("Semicolon terminator missing"); + stringsCbot[CBot::CBotErrCaseOut] = TR("Instruction \"case\" outside a block \"switch\""); + stringsCbot[CBot::CBotErrNoEnd] = TR("Instructions after the final closing brace"); + stringsCbot[CBot::CBotErrCloseBlock] = TR("End of block missing"); + stringsCbot[CBot::CBotErrElseWhitoutIf] = TR("Instruction \"else\" without corresponding \"if\" "); + stringsCbot[CBot::CBotErrOpenBlock] = TR("Opening brace missing "); + stringsCbot[CBot::CBotErrBadType1] = TR("Wrong type for the assignment"); + stringsCbot[CBot::CBotErrRedefVar] = TR("A variable can not be declared twice"); + stringsCbot[CBot::CBotErrBadType2] = TR("The types of the two operands are incompatible "); + stringsCbot[CBot::CBotErrUndefCall] = TR("Unknown function"); + stringsCbot[CBot::CBotErrNoDoubleDots] = TR("Sign \" : \" missing"); + stringsCbot[CBot::CBotErrNoWhile] = TR("Keyword \"while\" missing"); + stringsCbot[CBot::CBotErrBreakOutside] = TR("Instruction \"break\" outside a loop"); + stringsCbot[CBot::CBotErrLabel] = TR("A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\""); + stringsCbot[CBot::CBotErrUndefLabel] = TR("This label does not exist"); + stringsCbot[CBot::CBotErrNoCase] = TR("Instruction \"case\" missing"); + stringsCbot[CBot::CBotErrBadNum] = TR("Number missing"); + stringsCbot[CBot::CBotErrVoid] = TR("Void parameter"); + stringsCbot[CBot::CBotErrNoType] = TR("Type declaration missing"); + stringsCbot[CBot::CBotErrNoVar] = TR("Variable name missing"); + stringsCbot[CBot::CBotErrNoFunc] = TR("Function name missing"); + stringsCbot[CBot::CBotErrOverParam] = TR("Too many parameters"); + stringsCbot[CBot::CBotErrRedefFunc] = TR("Function already exists"); + stringsCbot[CBot::CBotErrLowParam] = TR("Parameters missing "); + stringsCbot[CBot::CBotErrBadParam] = TR("No function with this name accepts this kind of parameter"); + stringsCbot[CBot::CBotErrNbParam] = TR("No function with this name accepts this number of parameters"); + stringsCbot[CBot::CBotErrUndefItem] = TR("This is not a member of this class"); + stringsCbot[CBot::CBotErrUndefClass] = TR("This object is not a member of a class"); + stringsCbot[CBot::CBotErrNoConstruct] = TR("Appropriate constructor missing"); + stringsCbot[CBot::CBotErrRedefClass] = TR("This class already exists"); + stringsCbot[CBot::CBotErrCloseIndex] = TR("\" ] \" missing"); + stringsCbot[CBot::CBotErrReserved] = TR("Reserved keyword of CBOT language"); + stringsCbot[CBot::CBotErrBadNew] = TR("Bad argument for \"new\""); + stringsCbot[CBot::CBotErrOpenIndex] = TR("\" [ \" expected"); + stringsCbot[CBot::CBotErrBadString] = TR("String missing"); + stringsCbot[CBot::CBotErrBadIndex] = TR("Incorrect index type"); + stringsCbot[CBot::CBotErrPrivate] = TR("Private element"); + stringsCbot[CBot::CBotErrNoPublic] = TR("Public required"); - stringsCbot[CBotErrZeroDiv] = TR("Dividing by zero"); - stringsCbot[CBotErrNotInit] = TR("Variable not initialized"); - stringsCbot[CBotErrBadThrow] = TR("Negative value rejected by \"throw\""); - stringsCbot[CBotErrNoRetVal] = TR("The function returned no value "); - stringsCbot[CBotErrNoRun] = TR("No function running"); - stringsCbot[CBotErrUndefFunc] = TR("Calling an unknown function"); - stringsCbot[CBotErrNotClass] = TR("This class does not exist"); - stringsCbot[CBotErrNull] = TR("Unknown Object"); - stringsCbot[CBotErrNan] = TR("Operation impossible with value \"nan\""); - stringsCbot[CBotErrOutArray] = TR("Access beyond array limit"); - stringsCbot[CBotErrStackOver] = TR("Stack overflow"); - stringsCbot[CBotErrDeletedPtr] = TR("Illegal object"); - stringsCbot[CBotErrFileOpen] = TR("Can't open file"); - stringsCbot[CBotErrNotOpen] = TR("File not open"); - stringsCbot[CBotErrRead] = TR("Read error"); - stringsCbot[CBotErrWrite] = TR("Write error"); + stringsCbot[CBot::CBotErrZeroDiv] = TR("Dividing by zero"); + stringsCbot[CBot::CBotErrNotInit] = TR("Variable not initialized"); + stringsCbot[CBot::CBotErrBadThrow] = TR("Negative value rejected by \"throw\""); + stringsCbot[CBot::CBotErrNoRetVal] = TR("The function returned no value "); + stringsCbot[CBot::CBotErrNoRun] = TR("No function running"); + stringsCbot[CBot::CBotErrUndefFunc] = TR("Calling an unknown function"); + stringsCbot[CBot::CBotErrNotClass] = TR("This class does not exist"); + stringsCbot[CBot::CBotErrNull] = TR("Unknown Object"); + stringsCbot[CBot::CBotErrNan] = TR("Operation impossible with value \"nan\""); + stringsCbot[CBot::CBotErrOutArray] = TR("Access beyond array limit"); + stringsCbot[CBot::CBotErrStackOver] = TR("Stack overflow"); + stringsCbot[CBot::CBotErrDeletedPtr] = TR("Illegal object"); + stringsCbot[CBot::CBotErrFileOpen] = TR("Can't open file"); + stringsCbot[CBot::CBotErrNotOpen] = TR("File not open"); + stringsCbot[CBot::CBotErrRead] = TR("Read error"); + stringsCbot[CBot::CBotErrWrite] = TR("Write error"); } @@ -812,7 +812,7 @@ const char* GetResourceBase(ResType type, unsigned int num) break; case RES_CBOT: - assert(num < TX_MAX); + assert(num < CBot::CBotErrMAX); str = stringsCbot[num]; break; diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp index 3929cf3f..a482277b 100644 --- a/src/level/robotmain.cpp +++ b/src/level/robotmain.cpp @@ -4671,13 +4671,13 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::s } // Writes the file of stacks of execution. - FILE* file = fOpen((CResourceManager::GetSaveLocation() + "/" + filecbot).c_str(), "wb"); + FILE* file = CBot::fOpen((CResourceManager::GetSaveLocation() + "/" + filecbot).c_str(), "wb"); if (file == nullptr) return false; long version = 1; - fWrite(&version, sizeof(long), 1, file); // version of COLOBOT - version = CBotProgram::GetVersion(); - fWrite(&version, sizeof(long), 1, file); // version of CBOT + CBot::fWrite(&version, sizeof(long), 1, file); // version of COLOBOT + version = CBot::CBotProgram::GetVersion(); + CBot::fWrite(&version, sizeof(long), 1, file); // version of CBOT objRank = 0; for (CObject* obj : m_objMan->GetAllObjects()) @@ -4688,8 +4688,8 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::s if (!SaveFileStack(obj, file, objRank++)) break; } - CBotClass::SaveStaticState(file); - fClose(file); + CBot::CBotClass::SaveStaticState(file); + CBot::fClose(file); if (!emergencySave) { @@ -4868,15 +4868,15 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot) m_ui->GetLoadingScreen()->SetProgress(0.95f, RT_LOADING_CBOT_SAVE); // Reads the file of stacks of execution. - FILE* file = fOpen((CResourceManager::GetSaveLocation() + "/" + filecbot).c_str(), "rb"); + FILE* file = CBot::fOpen((CResourceManager::GetSaveLocation() + "/" + filecbot).c_str(), "rb"); if (file != nullptr) { long version; - fRead(&version, sizeof(long), 1, file); // version of COLOBOT + CBot::fRead(&version, sizeof(long), 1, file); // version of COLOBOT if (version == 1) { - fRead(&version, sizeof(long), 1, file); // version of CBOT - if (version == CBotProgram::GetVersion()) + CBot::fRead(&version, sizeof(long), 1, file); // version of CBOT + if (version == CBot::CBotProgram::GetVersion()) { objRank = 0; for (CObject* obj : m_objMan->GetAllObjects()) @@ -4889,8 +4889,8 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot) } } } - CBotClass::RestoreStaticState(file); - fClose(file); + CBot::CBotClass::RestoreStaticState(file); + CBot::fClose(file); } m_ui->GetLoadingScreen()->SetProgress(1.0f, RT_LOADING_FINISHED); diff --git a/src/object/implementation/programmable_impl.cpp b/src/object/implementation/programmable_impl.cpp index cea959ce..cbb759fa 100644 --- a/src/object/implementation/programmable_impl.cpp +++ b/src/object/implementation/programmable_impl.cpp @@ -144,10 +144,10 @@ bool CProgrammableObjectImpl::ReadStack(FILE *file) { short op; - fRead(&op, sizeof(short), 1, file); + CBot::fRead(&op, sizeof(short), 1, file); if ( op == 1 ) // run ? { - fRead(&op, sizeof(short), 1, file); // program rank + CBot::fRead(&op, sizeof(short), 1, file); // program rank if ( op >= 0 ) { if (m_object->Implements(ObjectInterfaceType::ProgramStorage)) @@ -176,20 +176,20 @@ bool CProgrammableObjectImpl::WriteStack(FILE *file) m_currentProgram->script->IsRunning() ) { op = 1; // run - fWrite(&op, sizeof(short), 1, file); + CBot::fWrite(&op, sizeof(short), 1, file); op = -1; if (m_object->Implements(ObjectInterfaceType::ProgramStorage)) { op = dynamic_cast(m_object)->GetProgramIndex(m_currentProgram); } - fWrite(&op, sizeof(short), 1, file); + CBot::fWrite(&op, sizeof(short), 1, file); return m_currentProgram->script->WriteStack(file); } op = 0; // stop - fWrite(&op, sizeof(short), 1, file); + CBot::fWrite(&op, sizeof(short), 1, file); return true; } diff --git a/src/object/object.cpp b/src/object/object.cpp index 85688796..38327efa 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -322,7 +322,7 @@ float CObject::GetProxyDistance() return m_proxyDistance; } -CBotVar* CObject::GetBotVar() +CBot::CBotVar* CObject::GetBotVar() { return m_botVar; } diff --git a/src/object/object.h b/src/object/object.h index be71b46f..47680aa0 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -37,7 +37,11 @@ struct ModelCrashSphere; } // namespace Gfx class CLevelParserLine; + +namespace CBot +{ class CBotVar; +} /** * \class CObject @@ -187,7 +191,7 @@ public: float GetProxyDistance(); //! Returns CBot "object" variable associated with this object - CBotVar* GetBotVar(); + CBot::CBotVar* GetBotVar(); //! Returns tooltip text for an object std::string GetTooltipText(); @@ -222,6 +226,6 @@ protected: int m_team; bool m_proxyActivate; float m_proxyDistance; - CBotVar* m_botVar; + CBot::CBotVar* m_botVar; bool m_lock; }; diff --git a/src/script/script.cpp b/src/script/script.cpp index 08110daf..a68d5e31 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -158,7 +158,7 @@ bool CScript::CheckToken() { if ( !m_object->GetCheckToken() ) return true; - m_error = CBotNoErr; + m_error = CBot::CBotNoErr; m_title[0] = 0; m_mainFunction[0] = 0; m_token[0] = 0; @@ -166,8 +166,8 @@ bool CScript::CheckToken() std::vector used(m_main->GetObligatoryToken(), false); - auto tokens = CBotToken::CompileTokens(m_script.get()); - CBotToken* bt = tokens.get(); + auto tokens = CBot::CBotToken::CompileTokens(m_script.get()); + CBot::CBotToken* bt = tokens.get(); while ( bt != nullptr ) { std::string token = bt->GetString(); @@ -182,7 +182,7 @@ bool CScript::CheckToken() if ( !m_main->IsProhibitedToken(token.c_str()) ) { - m_error = static_cast(ERR_PROHIBITEDTOKEN); + m_error = static_cast(ERR_PROHIBITEDTOKEN); m_cursor1 = cursor1; m_cursor2 = cursor2; strcpy(m_title, ""); @@ -199,7 +199,7 @@ bool CScript::CheckToken() if (!used[i]) // token not used? { strcpy(m_token, m_main->GetObligatoryToken(i)); - m_error = static_cast(ERR_OBLIGATORYTOKEN); + m_error = static_cast(ERR_OBLIGATORYTOKEN); strcpy(m_title, ""); m_mainFunction[0] = 0; return false; @@ -217,7 +217,7 @@ bool CScript::Compile() int i; std::string p; - m_error = CBotNoErr; + m_error = CBot::CBotNoErr; m_cursor1 = 0; m_cursor2 = 0; m_title[0] = 0; @@ -232,7 +232,7 @@ bool CScript::Compile() if (m_botProg == nullptr) { - m_botProg = MakeUnique(m_object->GetBotVar()); + m_botProg = MakeUnique(m_object->GetBotVar()); } if ( m_botProg->Compile(m_script.get(), functionList, this) ) @@ -490,9 +490,9 @@ bool CScript::GetCursor(int &cursor1, int &cursor2) // Put of the variables in a list. -void PutList(const char *baseName, bool bArray, CBotVar *var, Ui::CList *list, int &rankList) +void PutList(const char *baseName, bool bArray, CBot::CBotVar *var, Ui::CList *list, int &rankList) { - CBotVar *svar, *pStatic; + CBot::CBotVar *svar, *pStatic; char varName[100]; char buffer[100]; std::string p; @@ -536,25 +536,25 @@ void PutList(const char *baseName, bool bArray, CBotVar *var, Ui::CList *list, i type = pStatic->GetType(); - if ( type < CBotTypBoolean ) + if ( type < CBot::CBotTypBoolean ) { p = pStatic->GetValString(); sprintf(buffer, "%s = %s;", varName, p.c_str()); list->SetItemName(rankList++, buffer); } - else if ( type == CBotTypString ) + else if ( type == CBot::CBotTypString ) { p = pStatic->GetValString(); sprintf(buffer, "%s = \"%s\";", varName, p.c_str()); list->SetItemName(rankList++, buffer); } - else if ( type == CBotTypArrayPointer ) + else if ( type == CBot::CBotTypArrayPointer ) { svar = pStatic->GetItemList(); PutList(varName, true, svar, list, rankList); } - else if ( type == CBotTypClass || - type == CBotTypPointer ) + else if ( type == CBot::CBotTypClass || + type == CBot::CBotTypPointer ) { svar = pStatic->GetItemList(); PutList(varName, false, svar, list, rankList); @@ -574,7 +574,7 @@ void PutList(const char *baseName, bool bArray, CBotVar *var, Ui::CList *list, i void CScript::UpdateList(Ui::CList* list) { - CBotVar *var; + CBot::CBotVar *var; std::string progName, funcName; int total, select, level, cursor1, cursor2, rank; @@ -620,8 +620,8 @@ void CScript::ColorizeScript(Ui::CEdit* edit, int rangeStart, int rangeEnd) std::string text = std::string(edit->GetText(), edit->GetMaxChar()); text = text.substr(rangeStart, rangeEnd-rangeStart); - auto tokens = CBotToken::CompileTokens(text.c_str()); - CBotToken* bt = tokens.get(); + auto tokens = CBot::CBotToken::CompileTokens(text.c_str()); + CBot::CBotToken* bt = tokens.get(); while ( bt != nullptr ) { std::string token = bt->GetString(); @@ -636,31 +636,31 @@ void CScript::ColorizeScript(Ui::CEdit* edit, int rangeStart, int rangeEnd) cursor2 += rangeStart; Gfx::FontHighlight color = Gfx::FONT_HIGHLIGHT_NONE; - if ((type == TokenTypVar || (type >= TokenKeyWord && type < TokenKeyWord+100)) && IsType(token.c_str())) // types (basic types are TokenKeyWord, classes are TokenTypVar) + if ((type == CBot::TokenTypVar || (type >= CBot::TokenKeyWord && type < CBot::TokenKeyWord+100)) && IsType(token.c_str())) // types (basic types are TokenKeyWord, classes are TokenTypVar) { color = Gfx::FONT_HIGHLIGHT_TYPE; } - else if (type == TokenTypVar && IsFunction(token.c_str())) // functions + else if (type == CBot::TokenTypVar && IsFunction(token.c_str())) // functions { color = Gfx::FONT_HIGHLIGHT_TOKEN; } - else if (type == TokenTypVar && (token == "this" || token == "super")) // this, super + else if (type == CBot::TokenTypVar && (token == "this" || token == "super")) // this, super { color = Gfx::FONT_HIGHLIGHT_THIS; } - else if (type >= TokenKeyWord && type < TokenKeyWord+100) // builtin keywords + else if (type >= CBot::TokenKeyWord && type < CBot::TokenKeyWord+100) // builtin keywords { color = Gfx::FONT_HIGHLIGHT_KEYWORD; } - else if (type >= TokenKeyVal && type < TokenKeyVal+100) // true, false, null, nan + else if (type >= CBot::TokenKeyVal && type < CBot::TokenKeyVal+100) // true, false, null, nan { color = Gfx::FONT_HIGHLIGHT_CONST; } - else if (type == TokenTypDef) // constants (object types etc.) + else if (type == CBot::TokenTypDef) // constants (object types etc.) { color = Gfx::FONT_HIGHLIGHT_CONST; } - else if (type == TokenTypString || type == TokenTypNum) // string literals and numbers + else if (type == CBot::TokenTypString || type == CBot::TokenTypNum) // string literals and numbers { color = Gfx::FONT_HIGHLIGHT_STRING; } @@ -794,7 +794,7 @@ void CScript::GetError(std::string& error) } else { - if ( m_error == static_cast(ERR_OBLIGATORYTOKEN) ) + if ( m_error == static_cast(ERR_OBLIGATORYTOKEN) ) { std::string s; GetResource(RES_ERR, m_error, s); @@ -985,9 +985,9 @@ bool CScript::ReadStack(FILE *file) { int nb; - fRead(&nb, sizeof(int), 1, file); - fRead(&m_ipf, sizeof(int), 1, file); - fRead(&m_errMode, sizeof(int), 1, file); + CBot::fRead(&nb, sizeof(int), 1, file); + CBot::fRead(&m_ipf, sizeof(int), 1, file); + CBot::fRead(&m_errMode, sizeof(int), 1, file); if (m_botProg == nullptr) return false; if ( !m_botProg->RestoreState(file) ) return false; @@ -1004,9 +1004,9 @@ bool CScript::WriteStack(FILE *file) int nb; nb = 2; - fWrite(&nb, sizeof(int), 1, file); - fWrite(&m_ipf, sizeof(int), 1, file); - fWrite(&m_errMode, sizeof(int), 1, file); + CBot::fWrite(&nb, sizeof(int), 1, file); + CBot::fWrite(&m_ipf, sizeof(int), 1, file); + CBot::fWrite(&m_errMode, sizeof(int), 1, file); return m_botProg->SaveState(file); } diff --git a/src/script/script.h b/src/script/script.h index 395c4a4b..9b3c7ef7 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -106,7 +106,7 @@ protected: Gfx::CEngine* m_engine = nullptr; Ui::CInterface* m_interface = nullptr; - std::unique_ptr m_botProg; + std::unique_ptr m_botProg; CRobotMain* m_main = nullptr; Gfx::CTerrain* m_terrain = nullptr; Gfx::CWater* m_water = nullptr; @@ -123,7 +123,7 @@ protected: char m_mainFunction[50] = {}; char m_filename[50] = {}; // file name char m_token[50] = {}; // missing instruction - CBotError m_error = CBotNoErr; // error (0=ok) + CBot::CBotError m_error = CBot::CBotNoErr; // error (0=ok) int m_cursor1 = 0; int m_cursor2 = 0; boost::optional m_returnValue = boost::none; diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp index b730bf29..7b924308 100644 --- a/src/script/scriptfunc.cpp +++ b/src/script/scriptfunc.cpp @@ -67,6 +67,7 @@ #include "ui/displaytext.h" +using namespace CBot; CBotTypResult CScriptFunctions::cClassNull(CBotVar* thisclass, CBotVar* &var) { @@ -2976,7 +2977,6 @@ bool CScriptFunctions::rPointConstructor(CBotVar* pThis, CBotVar* var, CBotVar* return true; // no interruption } -class CBotFileAccessHandlerColobot; class CBotFileColobot : public CBotFile { public: @@ -3266,7 +3266,7 @@ void CScriptFunctions::Init() CBotProgram::AddFunction("pencolor", rPenColor, cOneFloat); CBotProgram::AddFunction("penwidth", rPenWidth, cOneFloat); - CBotProgram::AddFunction("camerafocus", rCameraFocus, CScriptFunctions::cOneObject); + CBotProgram::AddFunction("camerafocus", rCameraFocus, cOneObject); SetFileAccessHandler(MakeUnique()); } diff --git a/src/script/scriptfunc.h b/src/script/scriptfunc.h index 8746ae57..e6d6481a 100644 --- a/src/script/scriptfunc.h +++ b/src/script/scriptfunc.h @@ -35,7 +35,10 @@ class CObject; class CScript; class CExchangePost; +namespace CBot +{ class CBotVar; +} class CScriptFunctions @@ -43,123 +46,123 @@ class CScriptFunctions public: static void Init(); - static CBotVar* CreateObjectVar(CObject* obj); - static void DestroyObjectVar(CBotVar* botVar, bool permanent); + static CBot::CBotVar* CreateObjectVar(CObject* obj); + static void DestroyObjectVar(CBot::CBotVar* botVar, bool permanent); static bool CheckOpenFiles(); private: - static CBotTypResult cEndMission(CBotVar* &var, void* user); - static CBotTypResult cPlayMusic(CBotVar* &var, void* user); - static CBotTypResult cGetObject(CBotVar* &var, void* user); - static CBotTypResult cDelete(CBotVar* &var, void* user); - static CBotTypResult cSearch(CBotVar* &var, void* user); - static CBotTypResult cRadar(CBotVar* &var, void* user); - static CBotTypResult cRadarAll(CBotVar* &var, void* user); - static CBotTypResult cDetect(CBotVar* &var, void* user); - static CBotTypResult cDirection(CBotVar* &var, void* user); - static CBotTypResult cProduce(CBotVar* &var, void* user); - static CBotTypResult cDistance(CBotVar* &var, void* user); - static CBotTypResult cSpace(CBotVar* &var, void* user); - static CBotTypResult cFlatSpace(CBotVar* &var, void* user); - static CBotTypResult cFlatGround(CBotVar* &var, void* user); - static CBotTypResult cGoto(CBotVar* &var, void* user); - static CBotTypResult cGrabDrop(CBotVar* &var, void* user); - static CBotTypResult cReceive(CBotVar* &var, void* user); - static CBotTypResult cSend(CBotVar* &var, void* user); - static CBotTypResult cDeleteInfo(CBotVar* &var, void* user); - static CBotTypResult cTestInfo(CBotVar* &var, void* user); - static CBotTypResult cShield(CBotVar* &var, void* user); - static CBotTypResult cFire(CBotVar* &var, void* user); - static CBotTypResult cAim(CBotVar* &var, void* user); - static CBotTypResult cMotor(CBotVar* &var, void* user); - static CBotTypResult cTopo(CBotVar* &var, void* user); - static CBotTypResult cMessage(CBotVar* &var, void* user); - static CBotTypResult cPenDown(CBotVar* &var, void* user); + static CBot::CBotTypResult cEndMission(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cPlayMusic(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cGetObject(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cDelete(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cSearch(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cRadar(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cRadarAll(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cDetect(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cDirection(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cProduce(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cDistance(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cSpace(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cFlatSpace(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cFlatGround(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cGoto(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cGrabDrop(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cReceive(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cSend(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cDeleteInfo(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cTestInfo(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cShield(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cFire(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cAim(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cMotor(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cTopo(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cMessage(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cPenDown(CBot::CBotVar* &var, void* user); - static CBotTypResult cOnePoint(CBotVar* &var, void* user); - static CBotTypResult cPoint(CBotVar* &var, void* user); - static CBotTypResult cOneObject(CBotVar* &var, void* user); + static CBot::CBotTypResult cOnePoint(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cPoint(CBot::CBotVar* &var, void* user); + static CBot::CBotTypResult cOneObject(CBot::CBotVar* &var, void* user); - static bool rEndMission(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rPlayMusic(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rStopMusic(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rGetBuild(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rGetResearchEnable(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rGetResearchDone(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rSetBuild(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rSetResearchEnable(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rSetResearchDone(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rGetObjectById(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rGetObject(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rDelete(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rRadarAll(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rDirection(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rCanBuild(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rCanResearch(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rResearched(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rBuildingEnabled(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rBuild(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rDistance(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rDistance2d(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rFlatSpace(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rFlatGround(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rWait(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rMove(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rTurn(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rGoto(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rGrab(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rDrop(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rSniff(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rSend(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rThump(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rRecycle(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rShield(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rAim(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rMotor(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rJet(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rTopo(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rMessage(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rCmdline(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rIsMovie(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rErrMode(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rIPF(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rAbsTime(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rPenWidth(CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rCameraFocus(CBotVar* var, CBotVar* result, int& exception, void* user); + static bool rEndMission(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rPlayMusic(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rStopMusic(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rGetBuild(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rGetResearchEnable(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rGetResearchDone(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rSetBuild(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rSetResearchEnable(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rSetResearchDone(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rGetObjectById(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rGetObject(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rDelete(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rSearch(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rRadar(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rRadarAll(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rDetect(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rDirection(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rCanBuild(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rCanResearch(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rResearched(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rBuildingEnabled(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rBuild(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rProduce(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rDistance(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rDistance2d(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rSpace(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rFlatSpace(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rFlatGround(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rWait(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rMove(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rTurn(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rGoto(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rGrab(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rDrop(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rSniff(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rReceive(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rSend(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rDeleteInfo(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rTestInfo(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rThump(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rRecycle(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rShield(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rFire(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rAim(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rMotor(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rJet(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rTopo(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rMessage(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rCmdline(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rIsMovie(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rErrMode(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rIPF(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rAbsTime(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rPenDown(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rPenUp(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rPenColor(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rPenWidth(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rCameraFocus(CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); - static CBotTypResult cBusy(CBotVar* thisclass, CBotVar* &var); - static CBotTypResult cFactory(CBotVar* thisclass, CBotVar* &var); - static CBotTypResult cClassNull(CBotVar* thisclass, CBotVar* &var); - static CBotTypResult cClassOneFloat(CBotVar* thisclass, CBotVar* &var); + static CBot::CBotTypResult cBusy(CBot::CBotVar* thisclass, CBot::CBotVar* &var); + static CBot::CBotTypResult cFactory(CBot::CBotVar* thisclass, CBot::CBotVar* &var); + static CBot::CBotTypResult cClassNull(CBot::CBotVar* thisclass, CBot::CBotVar* &var); + static CBot::CBotTypResult cClassOneFloat(CBot::CBotVar* thisclass, CBot::CBotVar* &var); - static bool rBusy(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rFactory(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rResearch(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rTakeOff(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception, void* user); - static bool rDestroy(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception, void* user); + static bool rBusy(CBot::CBotVar* thisclass, CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rFactory(CBot::CBotVar* thisclass, CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rResearch(CBot::CBotVar* thisclass, CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rTakeOff(CBot::CBotVar* thisclass, CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); + static bool rDestroy(CBot::CBotVar* thisclass, CBot::CBotVar* var, CBot::CBotVar* result, int& exception, void* user); - static CBotTypResult cPointConstructor(CBotVar* pThis, CBotVar* &var); - static bool rPointConstructor(CBotVar* pThis, CBotVar* var, CBotVar* pResult, int& Exception, void* user); + static CBot::CBotTypResult cPointConstructor(CBot::CBotVar* pThis, CBot::CBotVar* &var); + static bool rPointConstructor(CBot::CBotVar* pThis, CBot::CBotVar* var, CBot::CBotVar* pResult, int& Exception, void* user); - static void uObject(CBotVar* botThis, void* user); + static void uObject(CBot::CBotVar* botThis, void* user); private: - static bool WaitForForegroundTask(CScript* script, CBotVar* result, int &exception); - static bool WaitForBackgroundTask(CScript* script, CBotVar* result, int &exception); + static bool WaitForForegroundTask(CScript* script, CBot::CBotVar* result, int &exception); + static bool WaitForBackgroundTask(CScript* script, CBot::CBotVar* result, int &exception); static bool ShouldTaskStop(Error err, int errMode); static CExchangePost* FindExchangePost(CObject* object, float power); }; diff --git a/test/unit/CBot/CBot.cpp b/test/unit/CBot/CBot.cpp index ca8fd22f..23c0bb4a 100644 --- a/test/unit/CBot/CBot.cpp +++ b/test/unit/CBot/CBot.cpp @@ -21,6 +21,8 @@ #include +using namespace CBot; + class CBotUT : public testing::Test { public: diff --git a/test/unit/CBot/CBotToken_test.cpp b/test/unit/CBot/CBotToken_test.cpp index 49a3416d..517cfb5b 100644 --- a/test/unit/CBot/CBotToken_test.cpp +++ b/test/unit/CBot/CBotToken_test.cpp @@ -22,6 +22,8 @@ #include +using namespace CBot; + class CBotTokenUT : public testing::Test { public: @@ -66,56 +68,56 @@ TEST_F(CBotTokenUT, CodeExample) { // this is the code example shown in the class documentation ExecuteTest("\tint var = 3 * ( pos.y + x );\n\tstring test = \"Hello world\";", { - {"int", ID_INT}, - {"var", TokenTypVar}, - {"=", ID_ASS}, - {"3", TokenTypNum}, - {"*", ID_MUL}, - {"(", ID_OPENPAR}, - {"pos", TokenTypVar}, - {".", ID_DOT}, - {"y", TokenTypVar}, - {"+", ID_ADD}, - {"x", TokenTypVar}, - {")", ID_CLOSEPAR}, - {";", ID_SEP}, - {"string", ID_STRING}, - {"test", TokenTypVar}, - {"=", ID_ASS}, - {"\"Hello world\"", TokenTypString}, - {";", ID_SEP}, + {"int", ID_INT}, + {"var", TokenTypVar}, + {"=", ID_ASS}, + {"3", TokenTypNum}, + {"*", ID_MUL}, + {"(", ID_OPENPAR}, + {"pos", TokenTypVar}, + {".", ID_DOT}, + {"y", TokenTypVar}, + {"+", ID_ADD}, + {"x", TokenTypVar}, + {")", ID_CLOSEPAR}, + {";", ID_SEP}, + {"string", ID_STRING}, + {"test", TokenTypVar}, + {"=", ID_ASS}, + {"\"Hello world\"", TokenTypString}, + {";", ID_SEP}, }); } TEST_F(CBotTokenUT, IgnoreComments) { ExecuteTest("int /* comment*/x = 5; //comment", { - {"int", ID_INT}, - {"x", TokenTypVar}, - {"=", ID_ASS}, - {"5", TokenTypNum}, - {";", ID_SEP}, + {"int", ID_INT}, + {"x", TokenTypVar}, + {"=", ID_ASS}, + {"5", TokenTypNum}, + {";", ID_SEP}, }); } TEST_F(CBotTokenUT, BasicProgram) { ExecuteTest("extern void object::TestProgram()\n{\n\t\n\tmessage(\"test\"+2.0);\n\t\n}\n", { - {"extern", ID_EXTERN}, - {"void", ID_VOID}, - {"object", TokenTypVar}, - {"::", ID_DBLDOTS}, - {"TestProgram", TokenTypVar}, - {"(", ID_OPENPAR}, - {")", ID_CLOSEPAR}, - {"{", ID_OPBLK}, - {"message", TokenTypVar}, - {"(", ID_OPENPAR}, - {"\"test\"", TokenTypString}, - {"+", ID_ADD}, - {"2.0", TokenTypNum}, - {")", ID_CLOSEPAR}, - {";", ID_SEP}, - {"}", ID_CLBLK}, + {"extern", ID_EXTERN}, + {"void", ID_VOID}, + {"object", TokenTypVar}, + {"::", ID_DBLDOTS}, + {"TestProgram", TokenTypVar}, + {"(", ID_OPENPAR}, + {")", ID_CLOSEPAR}, + {"{", ID_OPBLK}, + {"message", TokenTypVar}, + {"(", ID_OPENPAR}, + {"\"test\"", TokenTypString}, + {"+", ID_ADD}, + {"2.0", TokenTypNum}, + {")", ID_CLOSEPAR}, + {";", ID_SEP}, + {"}", ID_CLBLK}, }); } \ No newline at end of file