[colobot] 119/377: Moving CBotVar class in its own header and source files.

Didier Raboud odyx at moszumanska.debian.org
Wed Mar 30 13:34:05 UTC 2016


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

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

commit 660f17454af4f312d1c4942ec388ac5ae688f546
Author: Grunaka <dev at romainbreton.fr>
Date:   Sun Nov 15 23:18:47 2015 +0100

    Moving CBotVar class in its own header and source files.
---
 src/CBot/CBot.cpp                       |   1 +
 src/CBot/CBotCall.cpp                   |   2 +
 src/CBot/CBotCallMethode.cpp            |   2 +
 src/CBot/CBotClass.cpp                  |   2 +
 src/CBot/CBotClass.h                    |   2 +
 src/CBot/CBotDefines.h                  |   7 +
 src/CBot/CBotDll.h                      | 225 ------------
 src/CBot/CBotInstr/CBotBoolean.cpp      |   2 +
 src/CBot/CBotInstr/CBotCatch.cpp        |   2 +
 src/CBot/CBotInstr/CBotEmpty.cpp        |   2 +
 src/CBot/CBotInstr/CBotExprAlpha.cpp    |   2 +
 src/CBot/CBotInstr/CBotExprBool.cpp     |   2 +
 src/CBot/CBotInstr/CBotExprNan.cpp      |   2 +
 src/CBot/CBotInstr/CBotExprNull.cpp     |   2 +
 src/CBot/CBotInstr/CBotExprNum.cpp      |   2 +
 src/CBot/CBotInstr/CBotExprUnaire.cpp   |   2 +
 src/CBot/CBotInstr/CBotExprVar.h        |   2 +
 src/CBot/CBotInstr/CBotExpression.cpp   |   2 +
 src/CBot/CBotInstr/CBotFloat.cpp        |   2 +
 src/CBot/CBotInstr/CBotFunction.cpp     |   2 +
 src/CBot/CBotInstr/CBotIString.cpp      |   2 +
 src/CBot/CBotInstr/CBotInstArray.cpp    |   2 +
 src/CBot/CBotInstr/CBotInstrCall.cpp    |   2 +
 src/CBot/CBotInstr/CBotInstrMethode.cpp |   2 +
 src/CBot/CBotInstr/CBotInt.cpp          |   2 +
 src/CBot/CBotInstr/CBotLeftExprVar.cpp  |   2 +
 src/CBot/CBotInstr/CBotListArray.cpp    |   2 +
 src/CBot/CBotInstr/CBotNew.cpp          |   2 +
 src/CBot/CBotInstr/CBotParExpr.cpp      |   2 +
 src/CBot/CBotInstr/CBotPostIncExpr.cpp  |   2 +
 src/CBot/CBotInstr/CBotPreIncExpr.cpp   |   2 +
 src/CBot/CBotInstr/CBotTwoOpExpr.cpp    |   2 +
 src/CBot/CBotUtils.cpp                  |   2 +
 src/CBot/{ => CBotVar}/CBotVar.cpp      | 120 ++++--
 src/CBot/CBotVar/CBotVar.h              | 624 ++++++++++++++++++++++++++++++++
 src/CBot/CBotVar/CBotVarArray.h         |   2 +
 src/CBot/CBotVar/CBotVarBoolean.h       |   2 +
 src/CBot/CBotVar/CBotVarClass.h         |   2 +
 src/CBot/CBotVar/CBotVarFloat.h         |   2 +
 src/CBot/CBotVar/CBotVarInt.h           |   2 +
 src/CBot/CBotVar/CBotVarPointer.h       |   2 +-
 src/CBot/CBotVar/CBotVarString.h        |   2 +
 src/CBot/CMakeLists.txt                 |   2 +-
 src/CBot/StringFunctions.cpp            |   3 +
 src/script/script.cpp                   |   1 +
 src/script/scriptfunc.cpp               |   1 +
 46 files changed, 810 insertions(+), 248 deletions(-)

diff --git a/src/CBot/CBot.cpp b/src/CBot/CBot.cpp
index 76cfe2b..d528d1f 100644
--- a/src/CBot/CBot.cpp
+++ b/src/CBot/CBot.cpp
@@ -75,6 +75,7 @@
 #include "CBotStack.h"
 #include "CBotClass.h"
 
+#include "CBotVar/CBotVar.h"
 
 // Local include
 
diff --git a/src/CBot/CBotCall.cpp b/src/CBot/CBotCall.cpp
index 7796786..75beb6f 100644
--- a/src/CBot/CBotCall.cpp
+++ b/src/CBot/CBotCall.cpp
@@ -25,6 +25,8 @@
 
 #include "CBotUtils.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotCallMethode.cpp b/src/CBot/CBotCallMethode.cpp
index 6611129..2bcc41c 100644
--- a/src/CBot/CBotCallMethode.cpp
+++ b/src/CBot/CBotCallMethode.cpp
@@ -23,6 +23,8 @@
 #include "CBotUtils.h"
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotClass.cpp b/src/CBot/CBotClass.cpp
index 741dfb9..9e20d66 100644
--- a/src/CBot/CBotClass.cpp
+++ b/src/CBot/CBotClass.cpp
@@ -33,6 +33,8 @@
 #include "CBotUtils.h"
 #include "CBotCallMethode.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotClass.h b/src/CBot/CBotClass.h
index 3cc4f9f..fe38546 100644
--- a/src/CBot/CBotClass.h
+++ b/src/CBot/CBotClass.h
@@ -24,6 +24,8 @@
 
 #include "CBotProgram.h"
 
+#include "CBotDefines.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotDefines.h b/src/CBot/CBotDefines.h
index 2c6e34d..d09e3ca 100644
--- a/src/CBot/CBotDefines.h
+++ b/src/CBot/CBotDefines.h
@@ -26,3 +26,10 @@
 // Global include
 
 #define    MAXARRAYSIZE    9999
+
+
+// variable type SetPrivate / IsPrivate
+#define PR_PUBLIC    0        // public variable
+#define PR_READ      1        // read only
+#define PR_PROTECT   2        // protected (inheritance)
+#define PR_PRIVATE   3        // strictly private
diff --git a/src/CBot/CBotDll.h b/src/CBot/CBotDll.h
index 6bd1603..56b4364 100644
--- a/src/CBot/CBotDll.h
+++ b/src/CBot/CBotDll.h
@@ -494,231 +494,6 @@ bool rMean(CBotVar* pVar, CBotVar* pResult, int& Exception)
 
 #endif
 
-/////////////////////////////////////////////////////////////////////////////////
-// Class for managing variables
-
-// may be useful to the outside of the module
-// ( it is currently not expected to be able to create these objects in outer )
-
-// variable type SetPrivate / IsPrivate
-#define PR_PUBLIC    0        // public variable
-#define    PR_READ        1        // read only
-#define PR_PROTECT    2        // protected (inheritance)
-#define PR_PRIVATE    3        // strictly private
-
-class CBotVar
-{
-public:
-    // results of GetInit()
-    enum class InitType : int { UNDEF = 0, DEF = 1, IS_POINTER = 2, IS_NAN = 999 };
-
-protected:
-    CBotToken*        m_token;                    // the corresponding token
-
-    CBotVar*        m_next;                        // list of variables
-    friend class    CBotStack;
-    friend class    CBotCStack;
-    friend class    CBotInstrCall;
-    friend class    CBotProgram;
-
-    CBotTypResult    m_type;                        // type of value
-
-    InitType         m_binit;                    // not initialized?
-    CBotVarClass*    m_pMyThis;                    // ^ corresponding this element
-    void*            m_pUserPtr;                    // ^user data if necessary
-    bool            m_bStatic;                    // static element (in class)
-    int                m_mPrivate;                    // element public, protected or private?
-
-    CBotInstr*        m_InitExpr;                    // expression for the original content
-    CBotInstr*        m_LimExpr;                    // list of limits for a table
-    friend class    CBotClass;
-    friend class    CBotVarClass;
-    friend class    CBotVarPointer;
-    friend class    CBotVarArray;
-
-    long            m_ident;                    // unique identifier
-    static long        m_identcpt;                    // counter
-
-public:
-                    CBotVar();
-virtual                ~CBotVar( );                        // destructor
-
-    static
-    CBotVar*        Create( const char* name, CBotTypResult type);
-    //                creates from a complete type
-
-    static
-    CBotVar*        Create( const char* name, CBotClass* pClass);
-    //                creates from one instance of a known class
-
-    static
-    CBotVar*        Create( const CBotToken* name, int type );
-    static
-    CBotVar*        Create( const CBotToken* name, CBotTypResult type );
-
-    static
-    CBotVar*        Create( const char* name, int type, CBotClass* pClass);
-
-    static
-    CBotVar*        Create( CBotVar* pVar );
-
-    static void     Destroy(CBotVar* var);
-
-
-    void            SetUserPtr(void* pUser);
-    //                associate a user pointer to an instance
-
-    virtual void    SetIdent(long UniqId);
-    //                associates a unique identifier to an instance
-    //                ( it is used to ensure that the id is unique)
-
-    void*            GetUserPtr();
-    //                makes the pointer associated with the variable
-
-    CBotString        GetName();                    // the name of the variable, if known
-    ////////////////////////////////////////////////////////////////////////////////////
-    void            SetName(const char* name);    // changes the name of the variable
-
-    int                GetType(int mode = 0);          // returns the base type (int) of the variable
-                                                        // TODO check it
-    ////////////////////////////////////////////////////////////////////////////////////////
-
-    CBotTypResult    GetTypResult(int mode = 0);    // returns the complete type of the variable
-
-
-    CBotToken*        GetToken();
-    void            SetType(CBotTypResult& type);
-
-    void            SetInit(InitType initType);            // is the variable in the state UNDEF, DEF, NAN
-    InitType        GetInit() const;                       // gives the state of the variable
-    bool IsUndefined() const { return GetInit() == InitType::UNDEF; }
-    bool IsDefined() const { return GetInit() == InitType::DEF; }
-    bool IsNAN() const { return GetInit() == InitType::IS_NAN; }
-
-    void            SetStatic(bool bStatic);
-    bool            IsStatic();
-
-    void            SetPrivate(int mPrivate);
-    bool            IsPrivate(int mode = PR_PROTECT);
-    int                GetPrivate();
-
-    virtual
-    void            ConstructorSet();
-
-    void            SetVal(CBotVar* var);          // remprend une valeur
-                                                    // TODO remprend value
-    virtual
-    CBotVar*        GetItem(const char* name);    // returns an element of a class according to its name (*)
-    virtual
-    CBotVar*        GetItemRef(int nIdent);        // idem à partir du n° ref
-                                                    // TODO ditto from ref no.
-    virtual
-    CBotVar*        GetItem(int row, bool bGrow = false);
-
-    virtual
-    CBotVar*        GetItemList();                // lists the elements
-
-    CBotVar*        GetStaticVar();                // makes the pointer to the variable if it is static
-
-    bool            IsElemOfClass(const char* name);
-                                                // said if the element belongs to the class "name"
-                                                // makes true if the object is a subclass
-
-    CBotVar*        GetNext();                    // next variable in the list (parameters)
-    ////////////////////////////////////////////////////////////////////////////////////////////
-
-    void            AddNext(CBotVar* pVar);        // added to a list
-
-    virtual
-    void            Copy(CBotVar* pSrc, bool bName = true);    // makes a copy of the variable
-
-    virtual void    SetValInt(int val, const char* name = nullptr);
-                                                // initialized with an integer value (#)
-    /////////////////////////////////////////////////////////////////////////////////
-
-    virtual void    SetValFloat(float val);        // initialized with a real value (#)
-    ////////////////////////////////////////////////////////////////////////////////
-
-    virtual void    SetValString(const char* p);// initialized with a string value (#)
-    ////////////////////////////////////////////////////////////////////////////////
-
-    virtual int        GetValInt();                // request the full value (#)
-    ////////////////////////////////////////////////////////////////////////
-
-    virtual float    GetValFloat();                // gets real value (#)
-    ///////////////////////////////////////////////////////////////////////
-
-    virtual
-    CBotString         GetValString();                // request the string value (#)
-    ///////////////////////////////////////////////////////////////////////
-
-    virtual void    SetClass(CBotClass* pClass);
-    virtual
-    CBotClass*        GetClass();
-
-    virtual void    SetPointer(CBotVar* p);
-    virtual
-    CBotVarClass*    GetPointer();
-//    virtual void    SetIndirection(CBotVar* pVar);
-
-    virtual void    Add(CBotVar* left, CBotVar* right);    // addition
-    virtual void    Sub(CBotVar* left, CBotVar* right);    // subtraction
-    virtual void    Mul(CBotVar* left, CBotVar* right);    // multiplication
-    virtual int     Div(CBotVar* left, CBotVar* right);    // division
-    virtual int     Modulo(CBotVar* left, CBotVar* right);    // remainder of division
-    virtual void    Power(CBotVar* left, CBotVar* right);    // power
-
-    virtual bool    Lo(CBotVar* left, CBotVar* right);
-    virtual bool    Hi(CBotVar* left, CBotVar* right);
-    virtual bool    Ls(CBotVar* left, CBotVar* right);
-    virtual bool    Hs(CBotVar* left, CBotVar* right);
-    virtual bool    Eq(CBotVar* left, CBotVar* right);
-    virtual bool    Ne(CBotVar* left, CBotVar* right);
-
-    virtual void    And(CBotVar* left, CBotVar* right);
-    virtual void    Or(CBotVar* left, CBotVar* right);
-    virtual void    XOr(CBotVar* left, CBotVar* right);
-    virtual void    ASR(CBotVar* left, CBotVar* right);
-    virtual void    SR(CBotVar* left, CBotVar* right);
-    virtual void    SL(CBotVar* left, CBotVar* right);
-
-    virtual void    Neg();
-    virtual void    Not();
-    virtual void    Inc();
-    virtual void    Dec();
-
-
-    virtual bool    Save0State(FILE* pf);
-    virtual bool    Save1State(FILE* pf);
-    static    bool    RestoreState(FILE* pf, CBotVar* &pVar);
-
-    void            debug();
-
-//    virtual
-//    CBotVar*        GetMyThis();
-
-    virtual
-    void            Maj(void* pUser = nullptr, bool bContinue = true);
-
-    void            SetUniqNum(long n);
-    long            GetUniqNum();
-    static long        NextUniqNum();
-};
-
-/* NOTE (#)
-    methods    SetValInt() SetValFloat() et SetValString()
-    can be called  with objects which are respectively integer, real or string
-    Always be sure of the type of the variable before calling these methods
-
-    if ( pVar->GetType() == CBotInt() ) pVar->SetValFloat( 3.3 ); // plante !!
-
-    methods    GetValInt(), GetValFloat() et GetValString()
-    use value conversions,
-    GetValString() works on numbers (makes the corresponding string)
-    but do not make GetValInt () with a string variable!
-*/
-
-
 /*
 ////////////////////////////////////////////////////////////////////////
 // Examples of use
diff --git a/src/CBot/CBotInstr/CBotBoolean.cpp b/src/CBot/CBotInstr/CBotBoolean.cpp
index 6fda2db..ea0103e 100644
--- a/src/CBot/CBotInstr/CBotBoolean.cpp
+++ b/src/CBot/CBotInstr/CBotBoolean.cpp
@@ -25,6 +25,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotCatch.cpp b/src/CBot/CBotInstr/CBotCatch.cpp
index 77b5294..fdbc1d4 100644
--- a/src/CBot/CBotInstr/CBotCatch.cpp
+++ b/src/CBot/CBotInstr/CBotCatch.cpp
@@ -24,6 +24,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotEmpty.cpp b/src/CBot/CBotInstr/CBotEmpty.cpp
index 0f0ad7c..4318ead 100644
--- a/src/CBot/CBotInstr/CBotEmpty.cpp
+++ b/src/CBot/CBotInstr/CBotEmpty.cpp
@@ -22,6 +22,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotExprAlpha.cpp b/src/CBot/CBotInstr/CBotExprAlpha.cpp
index d0edb1d..6092375 100644
--- a/src/CBot/CBotInstr/CBotExprAlpha.cpp
+++ b/src/CBot/CBotInstr/CBotExprAlpha.cpp
@@ -22,6 +22,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotExprBool.cpp b/src/CBot/CBotInstr/CBotExprBool.cpp
index 3a25267..ebefa6d 100644
--- a/src/CBot/CBotInstr/CBotExprBool.cpp
+++ b/src/CBot/CBotInstr/CBotExprBool.cpp
@@ -22,6 +22,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotExprNan.cpp b/src/CBot/CBotInstr/CBotExprNan.cpp
index 7335219..a2cb1c6 100644
--- a/src/CBot/CBotInstr/CBotExprNan.cpp
+++ b/src/CBot/CBotInstr/CBotExprNan.cpp
@@ -22,6 +22,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotExprNull.cpp b/src/CBot/CBotInstr/CBotExprNull.cpp
index d80ef03..cef5eca 100644
--- a/src/CBot/CBotInstr/CBotExprNull.cpp
+++ b/src/CBot/CBotInstr/CBotExprNull.cpp
@@ -22,6 +22,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotExprNum.cpp b/src/CBot/CBotInstr/CBotExprNum.cpp
index 24ba0ac..6082c0e 100644
--- a/src/CBot/CBotInstr/CBotExprNum.cpp
+++ b/src/CBot/CBotInstr/CBotExprNum.cpp
@@ -22,6 +22,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotExprUnaire.cpp b/src/CBot/CBotInstr/CBotExprUnaire.cpp
index 2b7c0d6..4732eda 100644
--- a/src/CBot/CBotInstr/CBotExprUnaire.cpp
+++ b/src/CBot/CBotInstr/CBotExprUnaire.cpp
@@ -23,6 +23,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotExprVar.h b/src/CBot/CBotInstr/CBotExprVar.h
index 46017e5..a453565 100644
--- a/src/CBot/CBotInstr/CBotExprVar.h
+++ b/src/CBot/CBotInstr/CBotExprVar.h
@@ -22,6 +22,8 @@
 // Modules inlcude
 #include "CBot.h"
 
+#include "CBotDefines.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotExpression.cpp b/src/CBot/CBotInstr/CBotExpression.cpp
index 3637049..bdf096a 100644
--- a/src/CBot/CBotInstr/CBotExpression.cpp
+++ b/src/CBot/CBotInstr/CBotExpression.cpp
@@ -23,6 +23,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotFloat.cpp b/src/CBot/CBotInstr/CBotFloat.cpp
index 70a2c97..1a72145 100644
--- a/src/CBot/CBotInstr/CBotFloat.cpp
+++ b/src/CBot/CBotInstr/CBotFloat.cpp
@@ -25,6 +25,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotFunction.cpp b/src/CBot/CBotInstr/CBotFunction.cpp
index fd81a44..6700fab 100644
--- a/src/CBot/CBotInstr/CBotFunction.cpp
+++ b/src/CBot/CBotInstr/CBotFunction.cpp
@@ -34,6 +34,8 @@
 #include "CBotDefParam.h"
 #include "CBotUtils.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotIString.cpp b/src/CBot/CBotInstr/CBotIString.cpp
index 91e1a92..3c34811 100644
--- a/src/CBot/CBotInstr/CBotIString.cpp
+++ b/src/CBot/CBotInstr/CBotIString.cpp
@@ -24,6 +24,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotInstArray.cpp b/src/CBot/CBotInstr/CBotInstArray.cpp
index 4bf2fd1..f53cb65 100644
--- a/src/CBot/CBotInstr/CBotInstArray.cpp
+++ b/src/CBot/CBotInstr/CBotInstArray.cpp
@@ -29,6 +29,8 @@
 
 #include "CBotDefines.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotInstrCall.cpp b/src/CBot/CBotInstr/CBotInstrCall.cpp
index cec9810..c2c33b0 100644
--- a/src/CBot/CBotInstr/CBotInstrCall.cpp
+++ b/src/CBot/CBotInstr/CBotInstrCall.cpp
@@ -23,6 +23,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotInstrMethode.cpp b/src/CBot/CBotInstr/CBotInstrMethode.cpp
index a33207f..dabcd46 100644
--- a/src/CBot/CBotInstr/CBotInstrMethode.cpp
+++ b/src/CBot/CBotInstr/CBotInstrMethode.cpp
@@ -23,6 +23,8 @@
 #include "CBotStack.h"
 #include "CBotClass.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotInt.cpp b/src/CBot/CBotInstr/CBotInt.cpp
index f94d53c..1649de5 100644
--- a/src/CBot/CBotInstr/CBotInt.cpp
+++ b/src/CBot/CBotInstr/CBotInt.cpp
@@ -26,6 +26,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotLeftExprVar.cpp b/src/CBot/CBotInstr/CBotLeftExprVar.cpp
index ff0bbf1..d0c3482 100644
--- a/src/CBot/CBotInstr/CBotLeftExprVar.cpp
+++ b/src/CBot/CBotInstr/CBotLeftExprVar.cpp
@@ -22,6 +22,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotListArray.cpp b/src/CBot/CBotInstr/CBotListArray.cpp
index dc6e2b2..682505b 100644
--- a/src/CBot/CBotInstr/CBotListArray.cpp
+++ b/src/CBot/CBotInstr/CBotListArray.cpp
@@ -25,6 +25,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotNew.cpp b/src/CBot/CBotInstr/CBotNew.cpp
index 9da2a88..094e5a0 100644
--- a/src/CBot/CBotInstr/CBotNew.cpp
+++ b/src/CBot/CBotInstr/CBotNew.cpp
@@ -23,6 +23,8 @@
 #include "CBotStack.h"
 #include "CBotClass.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotParExpr.cpp b/src/CBot/CBotInstr/CBotParExpr.cpp
index 5d2839e..fc34b51 100644
--- a/src/CBot/CBotInstr/CBotParExpr.cpp
+++ b/src/CBot/CBotInstr/CBotParExpr.cpp
@@ -32,6 +32,8 @@
 #include "CBotExprNan.h"
 #include "CBotExpression.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotPostIncExpr.cpp b/src/CBot/CBotInstr/CBotPostIncExpr.cpp
index f7fbdda..938274e 100644
--- a/src/CBot/CBotInstr/CBotPostIncExpr.cpp
+++ b/src/CBot/CBotInstr/CBotPostIncExpr.cpp
@@ -23,6 +23,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotPreIncExpr.cpp b/src/CBot/CBotInstr/CBotPreIncExpr.cpp
index 5fe3d36..30ee9a9 100644
--- a/src/CBot/CBotInstr/CBotPreIncExpr.cpp
+++ b/src/CBot/CBotInstr/CBotPreIncExpr.cpp
@@ -23,6 +23,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotInstr/CBotTwoOpExpr.cpp b/src/CBot/CBotInstr/CBotTwoOpExpr.cpp
index 816efef..4ad5ad0 100644
--- a/src/CBot/CBotInstr/CBotTwoOpExpr.cpp
+++ b/src/CBot/CBotInstr/CBotTwoOpExpr.cpp
@@ -25,6 +25,8 @@
 
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotUtils.cpp b/src/CBot/CBotUtils.cpp
index eee71e4..b5f9c23 100644
--- a/src/CBot/CBotUtils.cpp
+++ b/src/CBot/CBotUtils.cpp
@@ -24,6 +24,8 @@
 #include "CBotClass.h"
 #include "CBotStack.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotVar.cpp b/src/CBot/CBotVar/CBotVar.cpp
similarity index 70%
rename from src/CBot/CBotVar.cpp
rename to src/CBot/CBotVar/CBotVar.cpp
index d5c248e..e2c1fe7 100644
--- a/src/CBot/CBotVar.cpp
+++ b/src/CBot/CBotVar/CBotVar.cpp
@@ -17,13 +17,9 @@
  * along with this program. If not, see http://gnu.org/licenses
  */
 
-////////////////////////////////////////////////////////////////////
-// Definition for the class CBotVar
-// variables management of the language CBoT
 
-// it never creates an instance of the class mother CBotVar
-
-#include "CBot.h"
+// Modules inlcude
+#include "CBotVar.h"
 
 #include "CBotStack.h"
 
@@ -37,12 +33,17 @@
 
 #include "CBotClass.h"
 
+// Local include
+
+// Global include
 #include <cassert>
 #include <cmath>
 #include <cstdio>
 
+////////////////////////////////////////////////////////////////////////////////
 long CBotVar::m_identcpt = 0;
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar::CBotVar( )
 {
     m_next    = nullptr;
@@ -57,12 +58,14 @@ CBotVar::CBotVar( )
     m_mPrivate = 0;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar::~CBotVar( )
 {
     delete  m_token;
     delete    m_next;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::debug()
 {
 //    const char*    p = static_cast<const char*>( m_token->GetString());
@@ -80,11 +83,13 @@ void CBotVar::debug()
     }
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::ConstructorSet()
 {
     // nop
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetUserPtr(void* pUser)
 {
     m_pUserPtr = pUser;
@@ -93,6 +98,7 @@ void CBotVar::SetUserPtr(void* pUser)
         (static_cast<CBotVarPointer*>(this))->m_pVarClass->SetUserPtr(pUser);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetIdent(long n)
 {
     if (m_type.Eq(CBotTypPointer) &&
@@ -100,6 +106,7 @@ void CBotVar::SetIdent(long n)
         (static_cast<CBotVarPointer*>(this))->m_pVarClass->SetIdent(n);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetUniqNum(long n)
 {
     m_ident = n;
@@ -107,23 +114,26 @@ void CBotVar::SetUniqNum(long n)
     if ( n == 0 ) assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 long CBotVar::NextUniqNum()
 {
     if (++m_identcpt < 10000) m_identcpt = 10000;
     return m_identcpt;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 long CBotVar::GetUniqNum()
 {
     return m_ident;
 }
 
-
+////////////////////////////////////////////////////////////////////////////////
 void* CBotVar::GetUserPtr()
 {
     return m_pUserPtr;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 bool CBotVar::Save1State(FILE* pf)
 {
     // this routine "virtual" must never be called,
@@ -133,21 +143,21 @@ bool CBotVar::Save1State(FILE* pf)
     return false;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Maj(void* pUser, bool bContinu)
 {
 /*    if (!bContinu && m_pMyThis != nullptr)
         m_pMyThis->Maj(pUser, true);*/
 }
 
-
-// creates a variable depending on its type
-
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::Create(const CBotToken* name, int type )
 {
     CBotTypResult    t(type);
     return Create(name, t);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::Create(const CBotToken* name, CBotTypResult type)
 {
     switch (type.GetType())
@@ -201,13 +211,14 @@ CBotVar* CBotVar::Create(const CBotToken* name, CBotTypResult type)
     return nullptr;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::Create( CBotVar* pVar )
 {
     CBotVar*    p = Create(pVar->m_token->GetString(), pVar->GetTypResult(2));
     return p;
 }
 
-
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::Create( const char* n, CBotTypResult type)
 {
     CBotToken    name(n);
@@ -272,6 +283,7 @@ CBotVar* CBotVar::Create( const char* n, CBotTypResult type)
     return nullptr;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::Create( const char* name, int type, CBotClass* pClass)
 {
     CBotToken    token( name, "" );
@@ -293,6 +305,7 @@ CBotVar* CBotVar::Create( const char* name, int type, CBotClass* pClass)
     return pVar;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::Create( const char* name, CBotClass* pClass)
 {
     CBotToken    token( name, "" );
@@ -301,11 +314,13 @@ CBotVar* CBotVar::Create( const char* name, CBotClass* pClass)
     return        pVar;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Destroy(CBotVar* var)
 {
     delete var;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotTypResult CBotVar::GetTypResult(int mode)
 {
     CBotTypResult    r = m_type;
@@ -318,6 +333,7 @@ CBotTypResult CBotVar::GetTypResult(int mode)
     return r;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 int CBotVar::GetType(int mode)
 {
     if ( mode == 1 && m_type.Eq(CBotTypClass) )
@@ -327,11 +343,13 @@ int CBotVar::GetType(int mode)
     return m_type.GetType();
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetType(CBotTypResult& type)
 {
     m_type = type;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar::InitType CBotVar::GetInit() const
 {
     if ( m_type.Eq(CBotTypClass) ) return InitType::DEF;        // always set!
@@ -339,6 +357,7 @@ CBotVar::InitType CBotVar::GetInit() const
     return m_binit;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetInit(CBotVar::InitType bInit)
 {
     m_binit = bInit;
@@ -368,46 +387,53 @@ void CBotVar::SetInit(CBotVar::InitType bInit)
     }
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotString CBotVar::GetName()
 {
     return    m_token->GetString();
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetName(const char* name)
 {
     m_token->SetString(name);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotToken* CBotVar::GetToken()
 {
     return    m_token;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::GetItem(const char* name)
 {
     assert(0);
     return nullptr;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::GetItemRef(int nIdent)
 {
     assert(0);
     return nullptr;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::GetItemList()
 {
     assert(0);
     return nullptr;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::GetItem(int row, bool bGrow)
 {
     assert(0);
     return nullptr;
 }
 
-// check if a variable belongs to a given class
+////////////////////////////////////////////////////////////////////////////////
 bool CBotVar::IsElemOfClass(const char* name)
 {
     CBotClass*    pc = nullptr;
@@ -430,7 +456,7 @@ bool CBotVar::IsElemOfClass(const char* name)
     return false;
 }
 
-
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::GetStaticVar()
 {
     // makes the pointer to the variable if it is static
@@ -440,12 +466,13 @@ CBotVar* CBotVar::GetStaticVar()
     return pClass->GetItem( m_token->GetString() );
 }
 
-
+////////////////////////////////////////////////////////////////////////////////
 CBotVar* CBotVar::GetNext()
 {
     return m_next;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::AddNext(CBotVar* pVar)
 {
     CBotVar*    p = this;
@@ -454,6 +481,7 @@ void CBotVar::AddNext(CBotVar* pVar)
     p->m_next = pVar;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetVal(CBotVar* var)
 {
     switch (var->GetType())
@@ -489,37 +517,43 @@ void CBotVar::SetVal(CBotVar* var)
     m_binit = var->m_binit;        // copie l'état nan s'il y a
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetStatic(bool bStatic)
 {
     m_bStatic = bStatic;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetPrivate(int mPrivate)
 {
     m_mPrivate = mPrivate;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 bool CBotVar::IsStatic()
 {
     return m_bStatic;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 bool CBotVar::IsPrivate(int mode)
 {
     return m_mPrivate >= mode;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 int CBotVar::GetPrivate()
 {
     return m_mPrivate;
 }
 
-
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetPointer(CBotVar* pVarClass)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotVarClass* CBotVar::GetPointer()
 {
     assert(0);
@@ -528,167 +562,198 @@ CBotVarClass* CBotVar::GetPointer()
 
 // All these functions must be defined in the subclasses
 // derived from class CBotVar
-
+////////////////////////////////////////////////////////////////////////////////
 int CBotVar::GetValInt()
 {
     assert(0);
     return 0;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 float CBotVar::GetValFloat()
 {
     assert(0);
     return 0;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetValInt(int c, const char* s)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetValFloat(float c)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Mul(CBotVar* left, CBotVar* right)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Power(CBotVar* left, CBotVar* right)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 int CBotVar::Div(CBotVar* left, CBotVar* right)
 {
     assert(0);
     return 0;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 int CBotVar::Modulo(CBotVar* left, CBotVar* right)
 {
     assert(0);
     return 0;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Add(CBotVar* left, CBotVar* right)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Sub(CBotVar* left, CBotVar* right)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 bool CBotVar::Lo(CBotVar* left, CBotVar* right)
 {
     assert(0);
     return false;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 bool CBotVar::Hi(CBotVar* left, CBotVar* right)
 {
     assert(0);
     return false;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 bool CBotVar::Ls(CBotVar* left, CBotVar* right)
 {
     assert(0);
     return false;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 bool CBotVar::Hs(CBotVar* left, CBotVar* right)
 {
     assert(0);
     return false;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 bool CBotVar::Eq(CBotVar* left, CBotVar* right)
 {
     assert(0);
     return false;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 bool CBotVar::Ne(CBotVar* left, CBotVar* right)
 {
     assert(0);
     return false;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::And(CBotVar* left, CBotVar* right)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Or(CBotVar* left, CBotVar* right)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::XOr(CBotVar* left, CBotVar* right)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::ASR(CBotVar* left, CBotVar* right)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SR(CBotVar* left, CBotVar* right)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SL(CBotVar* left, CBotVar* right)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Neg()
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Not()
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Inc()
 {
     assert(0);
 }
+
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Dec()
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::Copy(CBotVar* pSrc, bool bName)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetValString(const char* p)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotString CBotVar::GetValString()
 {
     assert(0);
     return CBotString();
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void CBotVar::SetClass(CBotClass* pClass)
 {
     assert(0);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotClass* CBotVar::GetClass()
 {
     assert(0);
@@ -698,7 +763,7 @@ CBotClass* CBotVar::GetClass()
 ///////////////////////////////////////////////////////
 // management of results types
 
-
+////////////////////////////////////////////////////////////////////////////////
 CBotTypResult::CBotTypResult(int type)
 {
     m_type        = type;
@@ -707,6 +772,7 @@ CBotTypResult::CBotTypResult(int type)
     m_limite    = -1;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotTypResult::CBotTypResult(int type, const char* name)
 {
     m_type        = type;
@@ -723,6 +789,7 @@ CBotTypResult::CBotTypResult(int type, const char* name)
     }
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotTypResult::CBotTypResult(int type, CBotClass* pClass)
 {
     m_type        = type;
@@ -733,6 +800,7 @@ CBotTypResult::CBotTypResult(int type, CBotClass* pClass)
     if ( m_pClass && m_pClass->IsIntrinsic() ) m_type = CBotTypIntrinsic;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotTypResult::CBotTypResult(int type, CBotTypResult elem)
 {
     m_type        = type;
@@ -745,6 +813,7 @@ CBotTypResult::CBotTypResult(int type, CBotTypResult elem)
         m_pNext = new CBotTypResult( elem );
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotTypResult::CBotTypResult(const CBotTypResult& typ)
 {
     m_type        = typ.m_type;
@@ -756,6 +825,7 @@ CBotTypResult::CBotTypResult(const CBotTypResult& typ)
         m_pNext = new CBotTypResult( *typ.m_pNext );
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotTypResult::CBotTypResult()
 {
     m_type        = 0;
@@ -764,11 +834,13 @@ CBotTypResult::CBotTypResult()
     m_pClass    = nullptr;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 CBotTypResult::~CBotTypResult()
 {
     delete    m_pNext;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 int CBotTypResult::GetType(int mode) const
 {
 #ifdef    _DEBUG
@@ -786,31 +858,37 @@ int CBotTypResult::GetType(int mode) const
     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;
@@ -822,8 +900,7 @@ void CBotTypResult::SetArray( int* max )
     }
 }
 
-
-
+////////////////////////////////////////////////////////////////////////////////
 bool CBotTypResult::Compare(const CBotTypResult& typ) const
 {
     if ( m_type != typ.m_type ) return false;
@@ -840,13 +917,14 @@ 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)
+////////////////////////////////////////////////////////////////////////////////
+CBotTypResult& CBotTypResult::operator=(const CBotTypResult& src)
 {
     m_type = src.m_type;
     m_limite = src.m_limite;
diff --git a/src/CBot/CBotVar/CBotVar.h b/src/CBot/CBotVar/CBotVar.h
new file mode 100644
index 0000000..8f465fc
--- /dev/null
+++ b/src/CBot/CBotVar/CBotVar.h
@@ -0,0 +1,624 @@
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsitec.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
+
+#pragma once
+
+// Modules inlcude
+#include "../CBotDll.h"
+
+#include "../CBotDefines.h"
+
+// Local include
+
+// Global include
+
+
+/*!
+ * \brief The CBotVar class Class for managing variables. May be useful to the
+ * outside of the module ( it is currently not expected to be able to create
+ * these objects in outer ). It never creates an instance of the class mother
+ * CBotVar.
+ */
+class CBotVar
+{
+public:
+    /*!
+     * \brief The InitType enum Results of GetInit().
+     */
+    enum class InitType : int
+    {
+        UNDEF = 0,
+        DEF = 1,
+        IS_POINTER = 2,
+        IS_NAN = 999
+    };
+
+    /*!
+     * \brief CBotVar
+     */
+    CBotVar();
+
+    /*!
+     * \brief ~CBotVar Destructor.
+     */
+    virtual ~CBotVar( );
+
+    /*!
+     * \brief Create Creates from a complete type.
+     * \param name
+     * \param type
+     * \return
+     */
+    static CBotVar* Create( const char* name, CBotTypResult type);
+
+    /*!
+     * \brief Create Creates from one instance of a known class.
+     * \param name
+     * \param pClass
+     * \return
+     */
+    static CBotVar* Create( const char* name, CBotClass* pClass);
+
+    /*!
+     * \brief Create Creates a variable depending on its type.
+     * \param name
+     * \param type
+     * \return
+     */
+    static CBotVar* Create( const CBotToken* name, int type );
+
+    /*!
+     * \brief Create
+     * \param name
+     * \param type
+     * \return
+     */
+    static CBotVar* Create( const CBotToken* name, CBotTypResult type );
+
+    /*!
+     * \brief Create
+     * \param name
+     * \param type
+     * \param pClass
+     * \return
+     */
+    static CBotVar* Create( const char* name, int type, CBotClass* pClass);
+
+    /*!
+     * \brief Create
+     * \param pVar
+     * \return
+     */
+    static CBotVar* Create( CBotVar* pVar );
+
+    /*!
+     * \brief Destroy
+     * \param var
+     */
+    static void Destroy(CBotVar* var);
+
+    /*!
+     * \brief SetUserPtr Associate a user pointer to an instance.
+     * \param pUser
+     */
+    void SetUserPtr(void* pUser);
+
+    /*!
+     * \brief SetIdent Associates a unique identifier to an instance
+     * ( it is used to ensure that the id is unique)
+     * \param UniqId
+     */
+    virtual void SetIdent(long UniqId);
+
+    /*!
+     * \brief GetUserPtr Makes the pointer associated with the variable.
+     * \return
+     */
+    void* GetUserPtr();
+
+    /*!
+     * \brief GetName The name of the variable, if known.
+     * \return
+     */
+    CBotString GetName();
+
+    /*!
+     * \brief SetName Changes the name of the variable
+     * \param name
+     */
+    void SetName(const char* name);
+
+    /*!
+     * \brief GetType Returns the base type (int) of the variable
+     * \param mode
+     * \return
+     * \todo Check it?
+     */
+    int GetType(int mode = 0);
+
+    /*!
+     * \brief GetTypResult Returns the complete type of the variable.
+     * \param mode
+     * \return
+     */
+    CBotTypResult GetTypResult(int mode = 0);
+
+    /*!
+     * \brief GetToken
+     * \return
+     */
+    CBotToken* GetToken();
+
+    /*!
+     * \brief SetType
+     * \param type
+     */
+    void SetType(CBotTypResult& type);
+
+    /*!
+     * \brief SetInit Is the variable in the state UNDEF, DEF, NAN.
+     * \param initType
+     */
+    void SetInit(InitType initType);
+
+    /*!
+     * \brief GetInit Gives the state of the variable.
+     * \return
+     */
+    InitType GetInit() const;
+
+    /*!
+     * \brief IsUndefined
+     * \return
+     */
+    bool IsUndefined() const { return GetInit() == InitType::UNDEF; }
+
+    /*!
+     * \brief IsDefined
+     * \return
+     */
+    bool IsDefined() const { return GetInit() == InitType::DEF; }
+
+    /*!
+     * \brief IsNAN
+     * \return
+     */
+    bool IsNAN() const { return GetInit() == InitType::IS_NAN; }
+
+    /*!
+     * \brief SetStatic
+     * \param bStatic
+     */
+    void SetStatic(bool bStatic);
+
+    /*!
+     * \brief IsStatic
+     * \return
+     */
+    bool IsStatic();
+
+    /*!
+     * \brief SetPrivate
+     * \param mPrivate
+     */
+    void SetPrivate(int mPrivate);
+
+    /*!
+     * \brief IsPrivate
+     * \param mode
+     * \return
+     */
+    bool IsPrivate(int mode = PR_PROTECT);
+
+    /*!
+     * \brief GetPrivate
+     * \return
+     */
+    int GetPrivate();
+
+    /*!
+     * \brief ConstructorSet
+     */
+    virtual void ConstructorSet();
+
+    /*!
+     * \brief SetVal Set the value.
+     * \param var
+     */
+    void SetVal(CBotVar* var);
+
+    /*!
+     * \brief GetItem Returns an element of a class according to its name (*).
+     * \param name
+     * \return
+     */
+    virtual CBotVar* GetItem(const char* name);
+
+    /*!
+     * \brief GetItemRef
+     * \param nIdent
+     * \return
+     */
+    virtual CBotVar* GetItemRef(int nIdent);
+
+    /*!
+     * \brief GetItem
+     * \param row
+     * \param bGrow
+     * \return
+     */
+    virtual CBotVar* GetItem(int row, bool bGrow = false);
+
+    /*!
+     * \brief GetItemList Lists the elements.
+     * \return
+     */
+    virtual CBotVar* GetItemList();
+
+    /*!
+     * \brief GetStaticVar Makes the pointer to the variable if it is static.
+     * \return
+     */
+    CBotVar* GetStaticVar();
+
+    /*!
+     * \brief IsElemOfClass Check if a variable belongs to a given class said if
+     * the element belongs to the class "name" makes true if the object is a
+     * subclass.
+     * \param name
+     * \return
+     */
+    bool IsElemOfClass(const char* name);
+
+    /*!
+     * \brief GetNext Next variable in the list (parameters).
+     * \return
+     */
+    CBotVar* GetNext();
+
+    /*!
+     * \brief AddNext Added to a list.
+     * \param pVar
+     */
+    void AddNext(CBotVar* pVar);
+
+    /*!
+     * \brief Copy Makes a copy of the variable.
+     * \param pSrc
+     * \param bName
+     */
+    virtual void Copy(CBotVar* pSrc, bool bName = true);
+
+    /*!
+     * \brief SetValInt Initialized with an integer value (#)
+     * \param val
+     * \param name
+     */
+    virtual void SetValInt(int val, const char* name = nullptr);
+
+    /*!
+     * \brief SetValFloat Initialized with a real value (#).
+     * \param val
+     */
+    virtual void SetValFloat(float val);
+
+    /*!
+     * \brief SetValString Initialized with a string value (#).
+     * \param p
+     */
+    virtual void SetValString(const char* p);
+
+    /*!
+     * \brief GetValInt Request the full value (#).
+     * \return
+     */
+    virtual int GetValInt();
+
+    /*!
+     * \brief GetValFloat Gets real value (#).
+     * \return
+     */
+    virtual float GetValFloat();
+
+    /*!
+     * \brief GetValString Request the string value (#).
+     * \return
+     */
+    virtual CBotString GetValString();
+
+    /*!
+     * \brief SetClass
+     * \param pClass
+     */
+    virtual void SetClass(CBotClass* pClass);
+
+    /*!
+     * \brief GetClass
+     * \return
+     */
+    virtual CBotClass* GetClass();
+
+    /*!
+     * \brief SetPointer
+     * \param p
+     */
+    virtual void SetPointer(CBotVar* p);
+
+    /*!
+     * \brief GetPointer
+     * \return
+     */
+    virtual CBotVarClass* GetPointer();
+
+    /*!
+     * \brief Add Addition
+     * \param left
+     * \param right
+     */
+    virtual void Add(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Sub Subtraction
+     * \param left
+     * \param right
+     */
+    virtual void Sub(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Mul Multiplication
+     * \param left
+     * \param right
+     */
+    virtual void Mul(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Div Division
+     * \param left
+     * \param right
+     * \return
+     */
+    virtual int Div(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Modulo Remainder of division
+     * \param left
+     * \param right
+     * \return
+     */
+    virtual int Modulo(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Power
+     * \param left
+     * \param right
+     */
+    virtual void Power(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Lo
+     * \param left
+     * \param right
+     * \return
+     */
+    virtual bool Lo(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Hi
+     * \param left
+     * \param right
+     * \return
+     */
+    virtual bool Hi(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Ls
+     * \param left
+     * \param right
+     * \return
+     */
+    virtual bool Ls(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Hs
+     * \param left
+     * \param right
+     * \return
+     */
+    virtual bool Hs(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Eq
+     * \param left
+     * \param right
+     * \return
+     */
+    virtual bool Eq(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Ne
+     * \param left
+     * \param right
+     * \return
+     */
+    virtual bool Ne(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief And
+     * \param left
+     * \param right
+     */
+    virtual void And(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Or
+     * \param left
+     * \param right
+     */
+    virtual void Or(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief XOr
+     * \param left
+     * \param right
+     */
+    virtual void XOr(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief ASR
+     * \param left
+     * \param right
+     */
+    virtual void ASR(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief SR
+     * \param left
+     * \param right
+     */
+    virtual void SR(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief SL
+     * \param left
+     * \param right
+     */
+    virtual void SL(CBotVar* left, CBotVar* right);
+
+    /*!
+     * \brief Neg
+     */
+    virtual void Neg();
+
+    /*!
+     * \brief Not
+     */
+    virtual void Not();
+
+    /*!
+     * \brief Inc
+     */
+    virtual void Inc();
+
+    /*!
+     * \brief Dec
+     */
+    virtual void Dec();
+
+    /*!
+     * \brief Save0State
+     * \param pf
+     * \return
+     */
+    virtual bool Save0State(FILE* pf);
+
+    /*!
+     * \brief Save1State
+     * \param pf
+     * \return
+     */
+    virtual bool Save1State(FILE* pf);
+
+    /*!
+     * \brief RestoreState
+     * \param pf
+     * \param pVar
+     * \return
+     */
+    static bool RestoreState(FILE* pf, CBotVar* &pVar);
+
+    /*!
+     * \brief debug
+     */
+    void debug();
+
+    /*!
+     * \brief Maj
+     * \param pUser
+     * \param bContinue
+     */
+    virtual void Maj(void* pUser = nullptr, bool bContinue = true);
+
+    /*!
+     * \brief SetUniqNum
+     * \param n
+     */
+    void SetUniqNum(long n);
+
+    /*!
+     * \brief GetUniqNum
+     * \return
+     */
+    long GetUniqNum();
+
+    /*!
+     * \brief NextUniqNum
+     * \return
+     */
+    static long NextUniqNum();
+
+protected:
+
+    //! The corresponding token.
+    CBotToken* m_token;
+    //! List of variables.
+    CBotVar* m_next;
+    //! Type of value.
+    CBotTypResult m_type;
+    //! Not initialized.
+    InitType m_binit;
+    //! Corresponding this element.
+    CBotVarClass* m_pMyThis;
+    //! User data if necessary.
+    void* m_pUserPtr;
+    //! Static element (in class).
+    bool m_bStatic;
+    //! Element public, protected or private.
+    int m_mPrivate;
+    //! Expression for the original content.
+    CBotInstr* m_InitExpr;
+    //! List of limits for a table.
+    CBotInstr* m_LimExpr;
+    //! Unique identifier.
+    long m_ident;
+
+    //! Counter
+    static long m_identcpt;
+
+    friend class CBotStack;
+    friend class CBotCStack;
+    friend class CBotInstrCall;
+    friend class CBotProgram;
+    friend class CBotClass;
+    friend class CBotVarClass;
+    friend class CBotVarPointer;
+    friend class CBotVarArray;
+};
+
+/* NOTE (#)
+    methods    SetValInt() SetValFloat() et SetValString()
+    can be called  with objects which are respectively integer, real or string
+    Always be sure of the type of the variable before calling these methods
+
+    if ( pVar->GetType() == CBotInt() ) pVar->SetValFloat( 3.3 ); // plante !!
+
+    methods    GetValInt(), GetValFloat() et GetValString()
+    use value conversions,
+    GetValString() works on numbers (makes the corresponding string)
+    but do not make GetValInt () with a string variable!
+*/
diff --git a/src/CBot/CBotVar/CBotVarArray.h b/src/CBot/CBotVar/CBotVarArray.h
index 158cdf8..65222ac 100644
--- a/src/CBot/CBotVar/CBotVarArray.h
+++ b/src/CBot/CBotVar/CBotVarArray.h
@@ -23,6 +23,8 @@
 #include "CBot.h"
 #include "CBotDefines.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotVar/CBotVarBoolean.h b/src/CBot/CBotVar/CBotVarBoolean.h
index e57c22f..f21cf28 100644
--- a/src/CBot/CBotVar/CBotVarBoolean.h
+++ b/src/CBot/CBotVar/CBotVarBoolean.h
@@ -22,6 +22,8 @@
 // Modules inlcude
 #include "CBotToken.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotVar/CBotVarClass.h b/src/CBot/CBotVar/CBotVarClass.h
index b7b878f..5089c40 100644
--- a/src/CBot/CBotVar/CBotVarClass.h
+++ b/src/CBot/CBotVar/CBotVarClass.h
@@ -22,6 +22,8 @@
 // Modules inlcude
 #include "CBot.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotVar/CBotVarFloat.h b/src/CBot/CBotVar/CBotVarFloat.h
index fb30cd4..07a3ecc 100644
--- a/src/CBot/CBotVar/CBotVarFloat.h
+++ b/src/CBot/CBotVar/CBotVarFloat.h
@@ -22,6 +22,8 @@
 // Modules inlcude
 #include "CBotDll.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotVar/CBotVarInt.h b/src/CBot/CBotVar/CBotVarInt.h
index 741fdc1..65ebb8c 100644
--- a/src/CBot/CBotVar/CBotVarInt.h
+++ b/src/CBot/CBotVar/CBotVarInt.h
@@ -22,6 +22,8 @@
 // Modules inlcude
 #include "CBotDll.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CBotVar/CBotVarPointer.h b/src/CBot/CBotVar/CBotVarPointer.h
index dbb6ea3..278fbd8 100644
--- a/src/CBot/CBotVar/CBotVarPointer.h
+++ b/src/CBot/CBotVar/CBotVarPointer.h
@@ -20,7 +20,7 @@
 #pragma once
 
 // Modules inlcude
-#include "CBotDll.h"
+#include "CBotVar/CBotVar.h"
 
 // Local include
 
diff --git a/src/CBot/CBotVar/CBotVarString.h b/src/CBot/CBotVar/CBotVarString.h
index 31c776e..93007be 100644
--- a/src/CBot/CBotVar/CBotVarString.h
+++ b/src/CBot/CBotVar/CBotVarString.h
@@ -22,6 +22,8 @@
 // Modules inlcude
 #include "CBotDll.h"
 
+#include "CBotVar/CBotVar.h"
+
 // Local include
 
 // Global include
diff --git a/src/CBot/CMakeLists.txt b/src/CBot/CMakeLists.txt
index 6e8a803..87303c4 100644
--- a/src/CBot/CMakeLists.txt
+++ b/src/CBot/CMakeLists.txt
@@ -5,7 +5,6 @@ set(SOURCES
     CBotStack.cpp
     CBotString.cpp
     CBotToken.cpp
-    CBotVar.cpp
     CBotCall.cpp
     CBotUtils.cpp
     CBotDefParam.cpp
@@ -62,6 +61,7 @@ set(SOURCES
     CBotVar/CBotVarString.cpp
     CBotVar/CBotVarFloat.cpp
     CBotVar/CBotVarInt.cpp
+    CBotVar/CBotVar.cpp
 )
 
 # Includes
diff --git a/src/CBot/StringFunctions.cpp b/src/CBot/StringFunctions.cpp
index 975421b..640efc1 100644
--- a/src/CBot/StringFunctions.cpp
+++ b/src/CBot/StringFunctions.cpp
@@ -17,12 +17,15 @@
  * along with this program. If not, see http://gnu.org/licenses
  */
 
+#include "CBotVar/CBotVar.h"
+
 // definition of string functions
 
 
 // gives the length of a chain
 // execution
 
+
 bool rStrLen( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
 {
     // it takes a parameter
diff --git a/src/script/script.cpp b/src/script/script.cpp
index 4ba1f17..d87a41a 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -43,6 +43,7 @@
 #include "ui/controls/list.h"
 
 #include "CBot/CBotToken.h"
+#include "CBot/CBotVar/CBotVar.h"
 
 
 const int CBOT_IPF = 100;       // CBOT: default number of instructions / frame
diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp
index 7ff6171..252f09d 100644
--- a/src/script/scriptfunc.cpp
+++ b/src/script/scriptfunc.cpp
@@ -21,6 +21,7 @@
 
 // TODO must be replaced by CBot.h
 #include "CBot/CBotClass.h"
+#include "CBot/CBotVar/CBotVar.h"
 
 #include "app/app.h"
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list