summaryrefslogtreecommitdiffstats
path: root/src/CBot
diff options
context:
space:
mode:
Diffstat (limited to 'src/CBot')
-rw-r--r--src/CBot/CBot.cpp33
-rw-r--r--src/CBot/CBot.h22
-rw-r--r--src/CBot/CBotDll.h19
-rw-r--r--src/CBot/CBotFunction.cpp2
-rw-r--r--src/CBot/CBotStack.cpp13
-rw-r--r--src/CBot/CBotString.cpp5
-rw-r--r--src/CBot/CBotToken.cpp2
-rw-r--r--src/CBot/CBotTwoOpExpr.cpp4
-rw-r--r--src/CBot/CBotVar.cpp130
-rw-r--r--src/CBot/ClassFILE.cpp2
-rw-r--r--src/CBot/TestCBot/CBotConsoleDlg.cpp6
-rw-r--r--src/CBot/TestCBot/CBotConsoleDlg.h4
-rw-r--r--src/CBot/TestCBot/ChildFrm.cpp4
-rw-r--r--src/CBot/TestCBot/ChildFrm.h4
-rw-r--r--src/CBot/TestCBot/MainFrm.cpp4
-rw-r--r--src/CBot/TestCBot/MainFrm.h4
-rw-r--r--src/CBot/TestCBot/PerformDlg.cpp4
-rw-r--r--src/CBot/TestCBot/PerformDlg.h4
-rw-r--r--src/CBot/TestCBot/TestCBotDoc.cpp2
-rw-r--r--src/CBot/TestCBot/TestCBotView.cpp4
20 files changed, 152 insertions, 120 deletions
diff --git a/src/CBot/CBot.cpp b/src/CBot/CBot.cpp
index 180113d..e2b01a9 100644
--- a/src/CBot/CBot.cpp
+++ b/src/CBot/CBot.cpp
@@ -29,6 +29,9 @@
#include "CBot.h"
+
+
+
// les divers constructeurs / destructeurs
// pour libérer tout selon l'arbre établi
CBotInstr::CBotInstr()
@@ -80,7 +83,7 @@ void CBotInstr::DecLvl()
}
// controle la validité d'un break ou continu
-BOOL CBotInstr::ChkLvl(CBotString& label, int type)
+BOOL CBotInstr::ChkLvl(const CBotString& label, int type)
{
int i = m_LoopLvl;
while (--i>=0)
@@ -291,7 +294,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
BOOL CBotInstr::Execute(CBotStack* &pj)
{
CBotString ClassManquante = name;
- __asm int 3; // ne doit jamais passer par cette routine
+ ASM_TRAP(); // ne doit jamais passer par cette routine
// mais utiliser les routines des classes filles
return FALSE;
}
@@ -306,26 +309,26 @@ BOOL CBotInstr::Execute(CBotStack* &pj, CBotVar* pVar)
void CBotInstr::RestoreState(CBotStack* &pj, BOOL bMain)
{
CBotString ClassManquante = name;
- __asm int 3; // ne doit jamais passer par cette routine
+ ASM_TRAP(); // ne doit jamais passer par cette routine
// mais utiliser les routines des classes filles
}
BOOL CBotInstr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile)
{
- __asm int 3; // papa sait pas faire, voir les filles
+ ASM_TRAP(); // papa sait pas faire, voir les filles
return FALSE;
}
BOOL CBotInstr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevToken, BOOL bStep, BOOL bExtend)
{
- __asm int 3; // papa sait pas faire, voir les filles
+ ASM_TRAP(); // papa sait pas faire, voir les filles
return FALSE;
}
void CBotInstr::RestoreStateVar(CBotStack* &pile, BOOL bMain)
{
- __asm int 3; // papa sait pas faire, voir les filles
+ ASM_TRAP(); // papa sait pas faire, voir les filles
}
// cette routine n'est définie que pour la classe fille CBotCase
@@ -538,7 +541,7 @@ void CBotLeftExprVar::RestoreState(CBotStack* &pj, BOOL bMain)
CBotVar* var1;
var1 = pj->FindVar(m_token.GivString());
- if ( var1 == NULL ) __asm int 3;
+ if ( var1 == NULL ) ASM_TRAP();
var1->SetUniqNum(m_nIdent); // avec cet identificateur unique
}
@@ -1777,7 +1780,7 @@ BOOL CBotExpression::Execute(CBotStack* &pj)
pile2->SetVar(result); // re-place le résultat
break;
default:
- __asm int 3;
+ ASM_TRAP();
}
if (!IsInit)
pile2->SetError(TX_NOTINIT, m_leftop->GivToken());
@@ -2298,7 +2301,7 @@ CBotIndexExpr::~CBotIndexExpr()
BOOL CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile)
{
if ( pVar->GivType(1) != CBotTypArrayPointer )
- __asm int 3;
+ ASM_TRAP();
pVar = ((CBotVarArray*)pVar)->GivItem(0, FALSE); // à la compilation rend l'élément [0]
if ( pVar == NULL )
@@ -2320,7 +2323,7 @@ BOOL CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
// DEBUG( "CBotIndexExpr::ExecuteVar", -1 , pj);
if ( pVar->GivType(1) != CBotTypArrayPointer )
- __asm int 3;
+ ASM_TRAP();
pile = pile->AddStack();
// if ( pile == EOX ) return TRUE;
@@ -2406,7 +2409,7 @@ void CBotFieldExpr::SetUniqNum(int num)
BOOL CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile)
{
if ( pVar->GivType(1) != CBotTypPointer )
- __asm int 3;
+ ASM_TRAP();
// pVar = pVar->GivItem(m_token.GivString());
pVar = pVar->GivItemRef(m_nIdent);
@@ -2433,7 +2436,7 @@ BOOL CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
// DEBUG( "CBotFieldExpre::ExecuteVar "+m_token.GivString(), 0, pj );
if ( pVar->GivType(1) != CBotTypPointer )
- __asm int 3;
+ ASM_TRAP();
CBotVarClass* pItem = pVar->GivPointer();
if ( pItem == NULL )
@@ -2693,7 +2696,7 @@ BOOL CBotLeftExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevT
if ( pVar == NULL )
{
#ifdef _DEBUG
- __asm int 3;
+ ASM_TRAP();
#endif
pile->SetError(2, &m_token);
return FALSE;
@@ -3346,7 +3349,7 @@ BOOL CBotExprVar::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* prevToke
if ( pVar == NULL )
{
#ifdef _DEBUG
- __asm int 3;
+ ASM_TRAP();
#endif
pj->SetError(1, &m_token);
return FALSE;
@@ -3969,7 +3972,7 @@ BOOL TypeCompatible( CBotTypResult& type1, CBotTypResult& type2, int op )
// regarde si deux variables sont compatible pour un passage de paramètre
-BOOL TypesCompatibles( CBotTypResult& type1, CBotTypResult& type2 )
+BOOL TypesCompatibles( const CBotTypResult& type1, const CBotTypResult& type2 )
{
int t1 = type1.GivType();
int t2 = type2.GivType();
diff --git a/src/CBot/CBot.h b/src/CBot/CBot.h
index ae2284a..e28bbee 100644
--- a/src/CBot/CBot.h
+++ b/src/CBot/CBot.h
@@ -30,6 +30,14 @@
#define EOX (CBotStack*)-1 // marqueur condition spéciale
+
+// fix for MSVC instruction __asm int 3 (setting a trap)
+#ifdef __MINGW32__
+#define ASM_TRAP() asm("int $3");
+#else
+#define ASM_TRAP() __asm int 3;
+#endif
+
/////////////////////////////////////////////////////////////////////
// résumé des classes utilisées, définies ci-après
@@ -372,7 +380,7 @@ public:
static
void DecLvl();
static
- BOOL ChkLvl(CBotString& label, int type);
+ BOOL ChkLvl(const CBotString& label, int type);
BOOL IsOfClass(CBotString name);
};
@@ -1194,7 +1202,7 @@ public:
};
// classe pour la gestion des nombres réels (float)
-class CBotVarFloat : CBotVar
+class CBotVarFloat : public CBotVar
{
private:
float m_val; // la valeur
@@ -1235,7 +1243,7 @@ public:
// classe pour la gestion des chaînes (String)
-class CBotVarString : CBotVar
+class CBotVarString : public CBotVar
{
private:
CBotString m_val; // la valeur
@@ -1262,7 +1270,7 @@ public:
};
// classe pour la gestion des boolean
-class CBotVarBoolean : CBotVar
+class CBotVarBoolean : public CBotVar
{
private:
BOOL m_val; // la valeur
@@ -1310,7 +1318,7 @@ private:
BOOL m_bConstructor; // set si un constructeur a été appelé
public:
- CBotVarClass( const CBotToken* name, CBotTypResult& type );
+ CBotVarClass( const CBotToken* name, const CBotTypResult& type );
// CBotVarClass( const CBotToken* name, CBotTypResult& type, int &nIdent );
~CBotVarClass();
// void InitCBotVarClass( const CBotToken* name, CBotTypResult& type, int &nIdent );
@@ -1424,7 +1432,7 @@ public:
extern CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars);
extern BOOL TypeCompatible( CBotTypResult& type1, CBotTypResult& type2, int op = 0 );
-extern BOOL TypesCompatibles( CBotTypResult& type1, CBotTypResult& type2 );
+extern BOOL TypesCompatibles( const CBotTypResult& type1, const CBotTypResult& type2 );
extern BOOL WriteWord(FILE* pf, WORD w);
extern BOOL ReadWord(FILE* pf, WORD& w);
@@ -1439,7 +1447,7 @@ extern BOOL ReadType(FILE* pf, CBotTypResult& type);
extern float GivNumFloat( const char* p );
-#ifdef _DEBUG
+#if FALSE
extern void DEBUG( const char* text, int val, CBotStack* pile );
#endif
diff --git a/src/CBot/CBotDll.h b/src/CBot/CBotDll.h
index ea67f2c..7fa9472 100644
--- a/src/CBot/CBotDll.h
+++ b/src/CBot/CBotDll.h
@@ -40,6 +40,7 @@ class CBotVarPointer; // pointeur à une instance de classe
class CBotCall; // les fonctions
class CBotCallMethode; // les méthodes
class CBotDefParam; // liste de paramètres
+class CBotCStack;
////////////////////////////////////////////////////////////////////////
@@ -106,7 +107,7 @@ public:
// pour les tableaux de variables
DllExport
- CBotTypResult(CBotTypResult& typ);
+ CBotTypResult(const CBotTypResult& typ);
// pour les assignations
DllExport
CBotTypResult();
@@ -115,18 +116,18 @@ public:
~CBotTypResult();
DllExport
- int GivType(int mode = 0);
+ int GivType(int mode = 0) const;
// rend le type CBotTyp* du résultat
void SetType(int n);
// modifie le type
DllExport
- CBotClass* GivClass();
+ CBotClass* GivClass() const;
// rend le pointeur à la classe (pour les CBotTypClass, CBotTypPointer)
DllExport
- int GivLimite();
+ int GivLimite() const;
// rend la taille limite du tableau (CBotTypArray)
DllExport
@@ -137,14 +138,14 @@ public:
// idem avec une liste de dimension (tableaux de tableaux)
DllExport
- CBotTypResult& GivTypElem();
+ CBotTypResult& GivTypElem() const;
// rend le type des éléments du tableau (CBotTypArray)
DllExport
- BOOL Compare(CBotTypResult& typ);
+ BOOL Compare(const CBotTypResult& typ) const;
// compare si les types sont compatibles
DllExport
- BOOL Eq(int type);
+ BOOL Eq(int type) const;
// compare le type
DllExport
@@ -274,7 +275,7 @@ public:
DllExport
void Empty();
DllExport
- BOOL IsEmpty();
+ BOOL IsEmpty() const;
DllExport
int GivLength();
DllExport
@@ -1048,7 +1049,7 @@ private:
public:
CBotToken();
CBotToken(const CBotToken* pSrc);
- CBotToken(CBotString& mot, CBotString& sep, int start=0, int end=0);
+ CBotToken(const CBotString& mot, const CBotString& sep, int start=0, int end=0);
CBotToken(const char* mot, const char* sep = NULL);
// constructeur
~CBotToken(); // destructeur
diff --git a/src/CBot/CBotFunction.cpp b/src/CBot/CBotFunction.cpp
index a7fbadc..488061c 100644
--- a/src/CBot/CBotFunction.cpp
+++ b/src/CBot/CBotFunction.cpp
@@ -1042,7 +1042,7 @@ BOOL CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
}
break;
default:
- __asm int 3;
+ ASM_TRAP();
}
}
newvar->SetUniqNum(p->m_nIdent);
diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp
index b97c2fd..b5aaba0 100644
--- a/src/CBot/CBotStack.cpp
+++ b/src/CBot/CBotStack.cpp
@@ -53,7 +53,8 @@ CBotStack* CBotStack::FirstStack()
CBotStack* pp = p;
pp += MAXSTACK;
- for ( int i = 0 ; i< 10 ; i++ )
+ int i;
+ for ( i = 0 ; i< 10 ; i++ )
{
pp->m_bOver = TRUE;
pp ++;
@@ -75,12 +76,12 @@ CBotStack* CBotStack::FirstStack()
CBotStack::CBotStack(CBotStack* ppapa)
{
// constructeur doit exister, sinon le destructeur n'est jamais appelé !
- __asm int 3;
+ ASM_TRAP();
}
CBotStack::~CBotStack()
{
- __asm int 3; // utiliser Delete() à la place
+ ASM_TRAP(); // utiliser Delete() à la place
}
void CBotStack::Delete()
@@ -696,7 +697,7 @@ void CBotStack::AddVar(CBotVar* pVar)
*pp = pVar; // ajoute à la suite
#ifdef _DEBUG
- if ( pVar->GivUniqNum() == 0 ) __asm int 3;
+ if ( pVar->GivUniqNum() == 0 ) ASM_TRAP();
#endif
}
@@ -1094,7 +1095,7 @@ BOOL CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
}
break;
default:
- __asm int 3;
+ ASM_TRAP();
}
if ( pPrev != NULL ) pPrev->m_next = pNew;
@@ -1391,7 +1392,7 @@ void CBotCStack::AddVar(CBotVar* pVar)
*pp = pVar; // ajoute à la suite
#ifdef _DEBUG
- if ( pVar->GivUniqNum() == 0 ) __asm int 3;
+ if ( pVar->GivUniqNum() == 0 ) ASM_TRAP();
#endif
}
diff --git a/src/CBot/CBotString.cpp b/src/CBot/CBotString.cpp
index 5d19861..2a1e3bd 100644
--- a/src/CBot/CBotString.cpp
+++ b/src/CBot/CBotString.cpp
@@ -92,7 +92,8 @@ CBotString CBotString::Right(int nCount) const
int i = m_lg - nCount;
if ( i < 0 ) i = 0;
- for ( int j = 0; i < m_lg && i < 1999; i++)
+ int j;
+ for ( j = 0 ; i < m_lg && i < 1999; i++)
{
chaine[j++] = m_ptr[i];
}
@@ -410,7 +411,7 @@ BOOL CBotString::operator<=(const char* p)
return Compare(p) <= 0;
}
-BOOL CBotString::IsEmpty()
+BOOL CBotString::IsEmpty() const
{
return (m_lg == 0);
}
diff --git a/src/CBot/CBotToken.cpp b/src/CBot/CBotToken.cpp
index 8fd6dbd..fbf6726 100644
--- a/src/CBot/CBotToken.cpp
+++ b/src/CBot/CBotToken.cpp
@@ -65,7 +65,7 @@ CBotToken::CBotToken(const CBotToken* pSrc)
}
}
-CBotToken::CBotToken(CBotString& mot, CBotString& sep, int start, int end)
+CBotToken::CBotToken(const CBotString& mot, const CBotString& sep, int start, int end)
{
m_Text = mot; // mot trouvé comme token
m_Sep = sep; // séparateurs qui suivent
diff --git a/src/CBot/CBotTwoOpExpr.cpp b/src/CBot/CBotTwoOpExpr.cpp
index 8594787..d8f4ee7 100644
--- a/src/CBot/CBotTwoOpExpr.cpp
+++ b/src/CBot/CBotTwoOpExpr.cpp
@@ -464,7 +464,7 @@ BOOL CBotTwoOpExpr::Execute(CBotStack* &pStack)
if ( !IsNan(left, right, &err) ) result->SL(left , right);
break;
default:
- __asm int 3;
+ ASM_TRAP();
}
delete temp;
@@ -563,4 +563,4 @@ void t(BOOL t)
x = 1 + t ? 1 : 3 + 4 * 2 ;
t ? 0 : "test";
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/CBot/CBotVar.cpp b/src/CBot/CBotVar.cpp
index 9d91759..37c8fb4 100644
--- a/src/CBot/CBotVar.cpp
+++ b/src/CBot/CBotVar.cpp
@@ -105,7 +105,7 @@ CBotVarBoolean::CBotVarBoolean( const CBotToken* name )
CBotVarClass* CBotVarClass::m_ExClass = NULL;
-CBotVarClass::CBotVarClass( const CBotToken* name, CBotTypResult& type)
+CBotVarClass::CBotVarClass( const CBotToken* name, const CBotTypResult& type)
{
/*
// int nIdent = 0;
@@ -123,7 +123,7 @@ void CBotVarClass::InitCBotVarClass( const CBotToken* name, CBotTypResult& type
!type.Eq(CBotTypIntrinsic) && // par comodité accepte ces types
!type.Eq(CBotTypPointer) &&
!type.Eq(CBotTypArrayPointer) &&
- !type.Eq(CBotTypArrayBody)) __asm int 3;
+ !type.Eq(CBotTypArrayBody)) ASM_TRAP();
m_token = new CBotToken(name);
m_next = NULL;
@@ -167,7 +167,7 @@ void CBotVarClass::InitCBotVarClass( const CBotToken* name, CBotTypResult& type
CBotVarClass::~CBotVarClass( )
{
if ( m_CptUse != 0 )
- __asm int 3;
+ ASM_TRAP();
if ( m_pParent ) delete m_pParent;
m_pParent = NULL;
@@ -240,7 +240,7 @@ void CBotVar::SetUniqNum(long n)
{
m_ident = n;
- if ( n == 0 ) __asm int 3;
+ if ( n == 0 ) ASM_TRAP();
}
long CBotVar::NextUniqNum()
@@ -265,7 +265,7 @@ BOOL CBotVar::Save1State(FILE* pf)
// cette routine "virtual" ne doit jamais être appellée,
// il doit y avoir une routine pour chaque classe fille (CBotVarInt, CBotVarFloat, etc)
// ( voir le type dans m_type )
- __asm int 3;
+ ASM_TRAP();
return FALSE;
}
@@ -333,7 +333,7 @@ CBotVar* CBotVar::Create(const CBotToken* name, CBotTypResult type)
}
}
- __asm int 3;
+ ASM_TRAP();
return NULL;
}
@@ -404,7 +404,7 @@ CBotVar* CBotVar::Create( const char* n, CBotTypResult type)
}
}
- __asm int 3;
+ ASM_TRAP();
return NULL;
}
@@ -517,25 +517,25 @@ CBotToken* CBotVar::GivToken()
CBotVar* CBotVar::GivItem(const char* name)
{
- __asm int 3;
+ ASM_TRAP();
return NULL;
}
CBotVar* CBotVar::GivItemRef(int nIdent)
{
- __asm int 3;
+ ASM_TRAP();
return NULL;
}
CBotVar* CBotVar::GivItemList()
{
- __asm int 3;
+ ASM_TRAP();
return NULL;
}
CBotVar* CBotVar::GivItem(int row, BOOL bGrow)
{
- __asm int 3;
+ ASM_TRAP();
return NULL;
}
@@ -615,7 +615,7 @@ void CBotVar::SetVal(CBotVar* var)
}
break;
default:
- __asm int 3;
+ ASM_TRAP();
}
m_binit = var->m_binit; // copie l'état nan s'il y a
@@ -649,12 +649,12 @@ int CBotVar::GivPrivate()
void CBotVar::SetPointer(CBotVar* pVarClass)
{
- __asm int 3;
+ ASM_TRAP();
}
CBotVarClass* CBotVar::GivPointer()
{
- __asm int 3;
+ ASM_TRAP();
return NULL;
}
@@ -663,167 +663,167 @@ CBotVarClass* CBotVar::GivPointer()
int CBotVar::GivValInt()
{
- __asm int 3;
+ ASM_TRAP();
return 0;
}
float CBotVar::GivValFloat()
{
- __asm int 3;
+ ASM_TRAP();
return 0;
}
void CBotVar::SetValInt(int c, const char* s)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::SetValFloat(float c)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::Mul(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::Power(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
}
int CBotVar::Div(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
return 0;
}
int CBotVar::Modulo(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
return 0;
}
void CBotVar::Add(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::Sub(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
}
BOOL CBotVar::Lo(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
return FALSE;
}
BOOL CBotVar::Hi(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
return FALSE;
}
BOOL CBotVar::Ls(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
return FALSE;
}
BOOL CBotVar::Hs(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
return FALSE;
}
BOOL CBotVar::Eq(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
return FALSE;
}
BOOL CBotVar::Ne(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
return FALSE;
}
void CBotVar::And(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::Or(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::XOr(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::ASR(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::SR(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::SL(CBotVar* left, CBotVar* right)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::Neg()
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::Not()
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::Inc()
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::Dec()
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::Copy(CBotVar* pSrc, BOOL bName)
{
- __asm int 3;
+ ASM_TRAP();
}
void CBotVar::SetValString(const char* p)
{
- __asm int 3;
+ ASM_TRAP();
}
CBotString CBotVar::GivValString()
{
- __asm int 3;
+ ASM_TRAP();
return CBotString();
}
void CBotVar::SetClass(CBotClass* pClass)
{
- __asm int 3;
+ ASM_TRAP();
}
CBotClass* CBotVar::GivClass()
{
- __asm int 3;
+ ASM_TRAP();
return NULL;
}
@@ -915,7 +915,7 @@ void CBotVarInt::Mul(CBotVar* left, CBotVar* right)
void CBotVarInt::Power(CBotVar* left, CBotVar* right)
{
- m_val = (int) pow( left->GivValInt() , right->GivValInt() );
+ m_val = (int) pow( (double) left->GivValInt() , (double) right->GivValInt() );
m_binit = TRUE;
}
@@ -1396,7 +1396,7 @@ void CBotVarClass::Copy(CBotVar* pSrc, BOOL bName)
pSrc = pSrc->GivPointer(); // si source donné par un pointeur
if ( pSrc->GivType() != CBotTypClass )
- __asm int 3;
+ ASM_TRAP();
CBotVarClass* p = (CBotVarClass*)pSrc;
@@ -1408,7 +1408,7 @@ void CBotVarClass::Copy(CBotVar* pSrc, BOOL bName)
m_pClass = p->m_pClass;
if ( p->m_pParent )
{
-__asm int 3; "que faire du pParent";
+ ASM_TRAP(); "que faire du pParent";
}
// m_next = NULL;
@@ -1613,7 +1613,7 @@ CBotString CBotVarClass::GivValString()
if ( m_pClass != NULL ) // pas utilisé pour un array
{
- res = m_pClass->GivName() + "( ";
+ res = m_pClass->GivName() + CBotString("( ");
CBotVarClass* my = this;
while ( my != NULL )
@@ -1621,7 +1621,7 @@ CBotString CBotVarClass::GivValString()
CBotVar* pv = my->m_pVar;
while ( pv != NULL )
{
- res += pv->GivName() + "=";
+ res += pv->GivName() + CBotString("=");
if ( pv->IsStatic() )
{
@@ -1766,7 +1766,7 @@ BOOL CBotVarClass::Ne(CBotVar* left, CBotVar* right)
CBotVarArray::CBotVarArray(const CBotToken* name, CBotTypResult& type )
{
if ( !type.Eq(CBotTypArrayPointer) &&
- !type.Eq(CBotTypArrayBody)) __asm int 3;
+ !type.Eq(CBotTypArrayBody)) ASM_TRAP();
m_token = new CBotToken(name);
m_next = NULL;
@@ -1789,7 +1789,7 @@ CBotVarArray::~CBotVarArray()
void CBotVarArray::Copy(CBotVar* pSrc, BOOL bName)
{
if ( pSrc->GivType() != CBotTypArrayPointer )
- __asm int 3;
+ ASM_TRAP();
CBotVarArray* p = (CBotVarArray*)pSrc;
@@ -1823,7 +1823,7 @@ void CBotVarArray::SetPointer(CBotVar* pVarClass)
if ( !pVarClass->m_type.Eq(CBotTypClass) &&
!pVarClass->m_type.Eq(CBotTypArrayBody))
- __asm int 3;
+ ASM_TRAP();
((CBotVarClass*)pVarClass)->IncrementUse(); // une référence en plus
}
@@ -1879,7 +1879,7 @@ CBotVarPointer::CBotVarPointer(const CBotToken* name, CBotTypResult& type )
if ( !type.Eq(CBotTypPointer) &&
!type.Eq(CBotTypNullPointer) &&
!type.Eq(CBotTypClass) && // par commodité accepte Class et Intrinsic
- !type.Eq(CBotTypIntrinsic) ) __asm int 3;
+ !type.Eq(CBotTypIntrinsic) ) ASM_TRAP();
m_token = new CBotToken(name);
m_next = NULL;
@@ -1962,7 +1962,7 @@ void CBotVarPointer::SetPointer(CBotVar* pVarClass)
// if ( pVarClass->GivType() != CBotTypClass )
if ( !pVarClass->m_type.Eq(CBotTypClass) )
- __asm int 3;
+ ASM_TRAP();
((CBotVarClass*)pVarClass)->IncrementUse(); // une référence en plus
m_pClass = ((CBotVarClass*)pVarClass)->m_pClass;
@@ -2031,7 +2031,7 @@ void CBotVarPointer::Copy(CBotVar* pSrc, BOOL bName)
{
if ( pSrc->GivType() != CBotTypPointer &&
pSrc->GivType() != CBotTypNullPointer)
- __asm int 3;
+ ASM_TRAP();
CBotVarPointer* p = (CBotVarPointer*)pSrc;
@@ -2128,7 +2128,7 @@ CBotTypResult::CBotTypResult(int type, CBotTypResult elem)
m_pNext = new CBotTypResult( elem );
}
-CBotTypResult::CBotTypResult(CBotTypResult& typ)
+CBotTypResult::CBotTypResult(const CBotTypResult& typ)
{
m_type = typ.m_type;
m_pClass = typ.m_pClass;
@@ -2152,18 +2152,18 @@ CBotTypResult::~CBotTypResult()
delete m_pNext;
}
-int CBotTypResult::GivType(int mode)
+int CBotTypResult::GivType(int mode) const
{
#ifdef _DEBUG
if ( m_type == CBotTypPointer ||
m_type == CBotTypClass ||
m_type == CBotTypIntrinsic )
- if ( m_pClass == NULL ) __asm int 3;
+ if ( m_pClass == NULL ) ASM_TRAP();
if ( m_type == CBotTypArrayPointer )
- if ( m_pNext == NULL ) __asm int 3;
+ if ( m_pNext == NULL ) ASM_TRAP();
#endif
if ( mode == 3 && m_type == CBotTypNullPointer ) return CBotTypPointer;
return m_type;
@@ -2174,17 +2174,17 @@ void CBotTypResult::SetType(int n)
m_type = n;
}
-CBotClass* CBotTypResult::GivClass()
+CBotClass* CBotTypResult::GivClass() const
{
return m_pClass;
}
-CBotTypResult& CBotTypResult::GivTypElem()
+CBotTypResult& CBotTypResult::GivTypElem() const
{
return *m_pNext;
}
-int CBotTypResult::GivLimite()
+int CBotTypResult::GivLimite() const
{
return m_limite;
}
@@ -2207,7 +2207,7 @@ void CBotTypResult::SetArray( int* max )
-BOOL CBotTypResult::Compare(CBotTypResult& typ)
+BOOL CBotTypResult::Compare(const CBotTypResult& typ) const
{
if ( m_type != typ.m_type ) return FALSE;
@@ -2223,7 +2223,7 @@ BOOL CBotTypResult::Compare(CBotTypResult& typ)
return TRUE;
}
-BOOL CBotTypResult::Eq(int type)
+BOOL CBotTypResult::Eq(int type) const
{
return m_type == type;
}
diff --git a/src/CBot/ClassFILE.cpp b/src/CBot/ClassFILE.cpp
index c80e109..e4dd578 100644
--- a/src/CBot/ClassFILE.cpp
+++ b/src/CBot/ClassFILE.cpp
@@ -292,7 +292,7 @@ BOOL rfwrite (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
FILE* pFile= (FILE*)pVar->GivValInt();
- int res = fputs(param+"\n", pFile);
+ int res = fputs(param+CBotString("\n"), pFile);
// en cas d'erreur génère une exception
if ( res < 0 ) { Exception = CBotErrWrite; return FALSE; }
diff --git a/src/CBot/TestCBot/CBotConsoleDlg.cpp b/src/CBot/TestCBot/CBotConsoleDlg.cpp
index 2305bf3..55a271a 100644
--- a/src/CBot/TestCBot/CBotConsoleDlg.cpp
+++ b/src/CBot/TestCBot/CBotConsoleDlg.cpp
@@ -12,7 +12,9 @@
// * 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://www.gnu.org/licenses/.// CBotConsoleDlg.cpp : implementation file
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+// CBotConsoleDlg.cpp : implementation file
//
#include "stdafx.h"
@@ -208,7 +210,7 @@ BOOL CBotConsoleDlg::OnInitDialog()
m_Edit1.ReplaceSel("Les fonctions suivantes sont disponibles:\r\n");
for ( int i = 0; i < m_pListe->GivSize(); i++ )
{
- CBotString x = (*m_pListe)[i] + "\r\n";
+ CBotString x = (*m_pListe)[i] + CBotString("\r\n");
m_Edit1.ReplaceSel(x);
}
m_Edit1.ReplaceSel("Entrez une commande ci-dessous.\r\n\r\n");
diff --git a/src/CBot/TestCBot/CBotConsoleDlg.h b/src/CBot/TestCBot/CBotConsoleDlg.h
index 52a6e16..f289a4d 100644
--- a/src/CBot/TestCBot/CBotConsoleDlg.h
+++ b/src/CBot/TestCBot/CBotConsoleDlg.h
@@ -12,7 +12,9 @@
// * 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://www.gnu.org/licenses/.#if !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_)
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+#if !defined(AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_)
#define AFX_BOTCONSOLEDLG_H__A11450A2_8E09_11D4_A439_00D059085115__INCLUDED_
#if _MSC_VER >= 1000
diff --git a/src/CBot/TestCBot/ChildFrm.cpp b/src/CBot/TestCBot/ChildFrm.cpp
index eb7f2b7..4c40f90 100644
--- a/src/CBot/TestCBot/ChildFrm.cpp
+++ b/src/CBot/TestCBot/ChildFrm.cpp
@@ -12,7 +12,9 @@
// * 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://www.gnu.org/licenses/.// ChildFrm.cpp : implementation of the CChildFrame class
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+// ChildFrm.cpp : implementation of the CChildFrame class
//
#include "stdafx.h"
diff --git a/src/CBot/TestCBot/ChildFrm.h b/src/CBot/TestCBot/ChildFrm.h
index d8918d4..2ad57b6 100644
--- a/src/CBot/TestCBot/ChildFrm.h
+++ b/src/CBot/TestCBot/ChildFrm.h
@@ -12,7 +12,9 @@
// * 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://www.gnu.org/licenses/.// ChildFrm.h : interface of the CChildFrame class
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+// ChildFrm.h : interface of the CChildFrame class
//
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/CBot/TestCBot/MainFrm.cpp b/src/CBot/TestCBot/MainFrm.cpp
index c3f6b9f..6669350 100644
--- a/src/CBot/TestCBot/MainFrm.cpp
+++ b/src/CBot/TestCBot/MainFrm.cpp
@@ -12,7 +12,9 @@
// * 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://www.gnu.org/licenses/.// MainFrm.cpp : implementation of the CMainFrame class
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
diff --git a/src/CBot/TestCBot/MainFrm.h b/src/CBot/TestCBot/MainFrm.h
index 0c4e737..a1d34f4 100644
--- a/src/CBot/TestCBot/MainFrm.h
+++ b/src/CBot/TestCBot/MainFrm.h
@@ -12,7 +12,9 @@
// * 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://www.gnu.org/licenses/.// MainFrm.h : interface of the CMainFrame class
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/CBot/TestCBot/PerformDlg.cpp b/src/CBot/TestCBot/PerformDlg.cpp
index f5ccd7b..8abbb4b 100644
--- a/src/CBot/TestCBot/PerformDlg.cpp
+++ b/src/CBot/TestCBot/PerformDlg.cpp
@@ -12,7 +12,9 @@
// * 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://www.gnu.org/licenses/.// PerformDlg.cpp : implementation file
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+// PerformDlg.cpp : implementation file
//
#include "stdafx.h"
diff --git a/src/CBot/TestCBot/PerformDlg.h b/src/CBot/TestCBot/PerformDlg.h
index 6a9a845..29d567f 100644
--- a/src/CBot/TestCBot/PerformDlg.h
+++ b/src/CBot/TestCBot/PerformDlg.h
@@ -12,7 +12,9 @@
// * 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://www.gnu.org/licenses/.#if !defined(AFX_PERFORMDLG_H__EAF2D560_97D8_11D4_A439_00D059085115__INCLUDED_)
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+#if !defined(AFX_PERFORMDLG_H__EAF2D560_97D8_11D4_A439_00D059085115__INCLUDED_)
#define AFX_PERFORMDLG_H__EAF2D560_97D8_11D4_A439_00D059085115__INCLUDED_
#if _MSC_VER >= 1000
diff --git a/src/CBot/TestCBot/TestCBotDoc.cpp b/src/CBot/TestCBot/TestCBotDoc.cpp
index fdb8604..8880c57 100644
--- a/src/CBot/TestCBot/TestCBotDoc.cpp
+++ b/src/CBot/TestCBot/TestCBotDoc.cpp
@@ -643,7 +643,7 @@ if ( mode == 2 ) if (!m_pProg->Compile(m_DocText, m_Liste, (void*) 44))
while ( pVar != NULL )
{
info += sep;
- info += pVar->GivName() + " = " + pVar->GivValString();
+ info += pVar->GivName() + CBotString(" = ") + pVar->GivValString();
sep = ", ";
pVar = pVar->GivNext();
}
diff --git a/src/CBot/TestCBot/TestCBotView.cpp b/src/CBot/TestCBot/TestCBotView.cpp
index e4710cb..bca3c56 100644
--- a/src/CBot/TestCBot/TestCBotView.cpp
+++ b/src/CBot/TestCBot/TestCBotView.cpp
@@ -12,7 +12,9 @@
// * 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://www.gnu.org/licenses/.// TestCBotView.cpp : implementation of the CTestCBotView class
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+// TestCBotView.cpp : implementation of the CTestCBotView class
//
#include "stdafx.h"