Reduced amount of warnings in CBot library

Changed most of C-style casting to C++ casting
Commented unused variables
dev-ui
Michał Konopacki 2012-08-13 01:26:36 +02:00
parent a9186d1960
commit e154e654f1
12 changed files with 157 additions and 152 deletions

View File

@ -602,7 +602,7 @@ CBotInstr* CBotInstArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu
inst->m_typevar = type; inst->m_typevar = type;
var->SetUniqNum( var->SetUniqNum(
((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
pStack->AddVar(var); // place it on the stack pStack->AddVar(var); // place it on the stack
if (IsOfType(p, ID_ASS)) // with an assignment if (IsOfType(p, ID_ASS)) // with an assignment
@ -670,7 +670,7 @@ bool CBotInstArray::Execute(CBotStack* &pj)
// create simply a NULL pointer // create simply a NULL pointer
CBotVar* var = CBotVar::Create(m_var->GetToken(), m_typevar); CBotVar* var = CBotVar::Create(m_var->GetToken(), m_typevar);
var->SetPointer(NULL); var->SetPointer(NULL);
var->SetUniqNum(((CBotLeftExprVar*)m_var)->m_nIdent); var->SetUniqNum((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent);
pj->AddVar(var); pj->AddVar(var);
#if STACKMEM #if STACKMEM
@ -685,7 +685,7 @@ bool CBotInstArray::Execute(CBotStack* &pj)
{ {
if (m_listass != NULL) // there is the assignment for this table if (m_listass != NULL) // there is the assignment for this table
{ {
CBotVar* pVar = pj->FindVar(((CBotLeftExprVar*)m_var)->m_nIdent); CBotVar* pVar = pj->FindVar((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent);
if (!m_listass->Execute(pile1, pVar)) return false; if (!m_listass->Execute(pile1, pVar)) return false;
} }
@ -705,7 +705,7 @@ void CBotInstArray::RestoreState(CBotStack* &pj, bool bMain)
CBotStack* pile1 = pj; CBotStack* pile1 = pj;
CBotVar* var = pj->FindVar(m_var->GetToken()->GetString()); CBotVar* var = pj->FindVar(m_var->GetToken()->GetString());
if (var != NULL) var->SetUniqNum(((CBotLeftExprVar*)m_var)->m_nIdent); if (var != NULL) var->SetUniqNum((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent);
if (bMain) if (bMain)
{ {
@ -970,7 +970,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
if (!cont && !IsOfType(p, ID_INT)) return NULL; if (!cont && !IsOfType(p, ID_INT)) return NULL;
CBotInt* inst = (CBotInt*)CompileArray(p, pStack, CBotTypInt); CBotInt* inst = static_cast<CBotInt*>(CompileArray(p, pStack, CBotTypInt));
if (inst != NULL || !pStack->IsOk()) return inst; if (inst != NULL || !pStack->IsOk()) return inst;
CBotCStack* pStk = pStack->TokenStack(pp); CBotCStack* pStk = pStack->TokenStack(pp);
@ -985,7 +985,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
// determines the expression is valid for the item on the left side // determines the expression is valid for the item on the left side
if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk ))) if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk )))
{ {
((CBotLeftExprVar*)inst->m_var)->m_typevar = CBotTypInt; (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypInt;
if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable
{ {
pStk->SetError(TX_REDEFVAR, vartoken); pStk->SetError(TX_REDEFVAR, vartoken);
@ -1014,7 +1014,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
return pStack->Return(inst2, pStk); return pStack->Return(inst2, pStk);
} }
} }
inst = (CBotInt*)inst2; inst = static_cast<CBotInt*>(inst2);
goto suite; // no assignment, variable already created goto suite; // no assignment, variable already created
} }
@ -1035,7 +1035,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
CBotVar* var = CBotVar::Create(vartoken, CBotTypInt);// create the variable (evaluated after the assignment) CBotVar* var = CBotVar::Create(vartoken, CBotTypInt);// create the variable (evaluated after the assignment)
var->SetInit(inst->m_expr != NULL); // if initialized with assignment var->SetInit(inst->m_expr != NULL); // if initialized with assignment
var->SetUniqNum( //set it with a unique number var->SetUniqNum( //set it with a unique number
((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
pStack->AddVar(var); // place it on the stack pStack->AddVar(var); // place it on the stack
} }
@ -1128,7 +1128,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
if (!cont && !IsOfType(p, ID_BOOLEAN, ID_BOOL)) return NULL; if (!cont && !IsOfType(p, ID_BOOLEAN, ID_BOOL)) return NULL;
CBotBoolean* inst = (CBotBoolean*)CompileArray(p, pStack, CBotTypBoolean); CBotBoolean* inst = static_cast<CBotBoolean*>(CompileArray(p, pStack, CBotTypBoolean));
if (inst != NULL || !pStack->IsOk()) return inst; if (inst != NULL || !pStack->IsOk()) return inst;
CBotCStack* pStk = pStack->TokenStack(pp); CBotCStack* pStk = pStack->TokenStack(pp);
@ -1143,7 +1143,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk ))) if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk )))
{ {
((CBotLeftExprVar*)inst->m_var)->m_typevar = CBotTypBoolean; (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypBoolean;
if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable
{ {
pStk->SetError(TX_REDEFVAR, vartoken); pStk->SetError(TX_REDEFVAR, vartoken);
@ -1157,7 +1157,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
// compiles an array declaration // compiles an array declaration
inst = (CBotBoolean*)CBotInstArray::Compile(p, pStk, CBotTypBoolean); inst = static_cast<CBotBoolean*>(CBotInstArray::Compile(p, pStk, CBotTypBoolean));
if (!pStk->IsOk() ) if (!pStk->IsOk() )
{ {
@ -1183,7 +1183,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
var = CBotVar::Create(vartoken, CBotTypBoolean);// create the variable (evaluated after the assignment) var = CBotVar::Create(vartoken, CBotTypBoolean);// create the variable (evaluated after the assignment)
var->SetInit(inst->m_expr != NULL); var->SetInit(inst->m_expr != NULL);
var->SetUniqNum( var->SetUniqNum(
((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
pStack->AddVar(var); pStack->AddVar(var);
suite: suite:
if (IsOfType(p, ID_COMMA)) if (IsOfType(p, ID_COMMA))
@ -1276,7 +1276,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool
if (!cont && !IsOfType(p, ID_FLOAT)) return NULL; if (!cont && !IsOfType(p, ID_FLOAT)) return NULL;
CBotFloat* inst = (CBotFloat*)CompileArray(p, pStack, CBotTypFloat); CBotFloat* inst = static_cast<CBotFloat*>(CompileArray(p, pStack, CBotTypFloat));
if (inst != NULL || !pStack->IsOk()) return inst; if (inst != NULL || !pStack->IsOk()) return inst;
CBotCStack* pStk = pStack->TokenStack(pp); CBotCStack* pStk = pStack->TokenStack(pp);
@ -1291,7 +1291,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool
if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk ))) if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk )))
{ {
((CBotLeftExprVar*)inst->m_var)->m_typevar = CBotTypFloat; (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypFloat;
if (pStk->CheckVarLocal(vartoken)) // redefinition of a variable if (pStk->CheckVarLocal(vartoken)) // redefinition of a variable
{ {
pStk->SetStartError(vartoken->GetStart()); pStk->SetStartError(vartoken->GetStart());
@ -1303,7 +1303,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool
{ {
delete inst; delete inst;
p = vartoken; p = vartoken;
inst = (CBotFloat*)CBotInstArray::Compile(p, pStk, CBotTypFloat); inst = static_cast<CBotFloat*>(CBotInstArray::Compile(p, pStk, CBotTypFloat));
if (!pStk->IsOk() ) if (!pStk->IsOk() )
{ {
@ -1329,7 +1329,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool
var = CBotVar::Create(vartoken, CBotTypFloat); var = CBotVar::Create(vartoken, CBotTypFloat);
var->SetInit(inst->m_expr != NULL); var->SetInit(inst->m_expr != NULL);
var->SetUniqNum( var->SetUniqNum(
((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
pStack->AddVar(var); pStack->AddVar(var);
suite: suite:
if (IsOfType(p, ID_COMMA)) if (IsOfType(p, ID_COMMA))
@ -1422,7 +1422,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
if (!cont && !IsOfType(p, ID_STRING)) return NULL; if (!cont && !IsOfType(p, ID_STRING)) return NULL;
CBotIString* inst = (CBotIString*)CompileArray(p, pStack, CBotTypString); CBotIString* inst = static_cast<CBotIString*>(CompileArray(p, pStack, CBotTypString));
if (inst != NULL || !pStack->IsOk()) return inst; if (inst != NULL || !pStack->IsOk()) return inst;
CBotCStack* pStk = pStack->TokenStack(pp); CBotCStack* pStk = pStack->TokenStack(pp);
@ -1436,7 +1436,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk ))) if (NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk )))
{ {
((CBotLeftExprVar*)inst->m_var)->m_typevar = CBotTypString; (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = CBotTypString;
if (pStk->CheckVarLocal(vartoken)) if (pStk->CheckVarLocal(vartoken))
{ {
pStk->SetStartError(vartoken->GetStart()); pStk->SetStartError(vartoken->GetStart());
@ -1460,7 +1460,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
CBotVar* var = CBotVar::Create(vartoken, CBotTypString); CBotVar* var = CBotVar::Create(vartoken, CBotTypString);
var->SetInit(inst->m_expr != NULL); var->SetInit(inst->m_expr != NULL);
var->SetUniqNum( var->SetUniqNum(
((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
pStack->AddVar(var); pStack->AddVar(var);
if (IsOfType(p, ID_COMMA)) if (IsOfType(p, ID_COMMA))
@ -1657,7 +1657,8 @@ bool CBotExpression::Execute(CBotStack* &pj)
{ {
CBotStack* pile = pj->AddStack(this); CBotStack* pile = pj->AddStack(this);
CBotToken* pToken = m_leftop->GetToken(); // CBotToken* pToken = m_leftop->GetToken();
CBotVar* pVar = NULL; CBotVar* pVar = NULL;
CBotStack* pile1 = pile; CBotStack* pile1 = pile;
@ -1768,8 +1769,8 @@ void CBotExpression::RestoreState(CBotStack* &pj, bool bMain)
{ {
if (bMain) if (bMain)
{ {
CBotToken* pToken = m_leftop->GetToken(); // CBotToken* pToken = m_leftop->GetToken();
CBotVar* pVar = NULL; // CBotVar* pVar = NULL;
CBotStack* pile = pj->RestoreStack(this); CBotStack* pile = pj->RestoreStack(this);
if (pile == NULL) return; if (pile == NULL) return;
@ -2063,7 +2064,7 @@ bool CBotPostIncExpr::Execute(CBotStack* &pj)
CBotVar* var1 = NULL; CBotVar* var1 = NULL;
// retrieves the variable fields and indexes according // retrieves the variable fields and indexes according
if (!((CBotExprVar*)m_Instr)->ExecuteVar(var1, pile2, NULL, true)) return false; if (!(static_cast<CBotExprVar*>(m_Instr))->ExecuteVar(var1, pile2, NULL, true)) return false;
pile1->SetState(1); pile1->SetState(1);
pile1->SetCopyVar(var1); // places the result (before incrementation); pile1->SetCopyVar(var1); // places the result (before incrementation);
@ -2094,7 +2095,7 @@ void CBotPostIncExpr::RestoreState(CBotStack* &pj, bool bMain)
CBotStack* pile1 = pj->RestoreStack(this); CBotStack* pile1 = pj->RestoreStack(this);
if (pile1 == NULL) return; if (pile1 == NULL) return;
((CBotExprVar*)m_Instr)->RestoreStateVar(pile1, bMain); (static_cast<CBotExprVar*>(m_Instr))->RestoreStateVar(pile1, bMain);
if (pile1 != NULL) pile1->RestoreStack(this); if (pile1 != NULL) pile1->RestoreStack(this);
} }
@ -2112,7 +2113,7 @@ bool CBotPreIncExpr::Execute(CBotStack* &pj)
CBotStack* pile2 = pile; CBotStack* pile2 = pile;
// retrieves the variable fields and indexes according // retrieves the variable fields and indexes according
// pile2 is modified on return // pile2 is modified on return
if (!((CBotExprVar*)m_Instr)->ExecuteVar(var1, pile2, NULL, true)) return false; if (!(static_cast<CBotExprVar*>(m_Instr))->ExecuteVar(var1, pile2, NULL, true)) return false;
if (var1->GetInit() == IS_NAN) if (var1->GetInit() == IS_NAN)
{ {
@ -2274,7 +2275,7 @@ bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotCStack* &pile)
if (pVar->GetType(1) != CBotTypArrayPointer) if (pVar->GetType(1) != CBotTypArrayPointer)
ASM_TRAP(); ASM_TRAP();
pVar = ((CBotVarArray*)pVar)->GetItem(0, false); // at compile time makes the element [0] pVar = (static_cast<CBotVarArray*>(pVar))->GetItem(0, false); // at compile time makes the element [0]
if (pVar == NULL) if (pVar == NULL)
{ {
pile->SetError(TX_OUTARRAY, m_token.GetEnd()); pile->SetError(TX_OUTARRAY, m_token.GetEnd());
@ -2314,7 +2315,7 @@ bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
int n = p->GetValInt(); // position in the table int n = p->GetValInt(); // position in the table
pVar = ((CBotVarArray*)pVar)->GetItem(n, bExtend); pVar = (static_cast<CBotVarArray*>(pVar))->GetItem(n, bExtend);
if (pVar == NULL) if (pVar == NULL)
{ {
pile->SetError(TX_OUTARRAY, prevToken); pile->SetError(TX_OUTARRAY, prevToken);
@ -2524,7 +2525,7 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack)
i->m_expr = CBotExpression::Compile(p, pStk); i->m_expr = CBotExpression::Compile(p, pStk);
inst->AddNext3(i); // add to the chain inst->AddNext3(i); // add to the chain
var = ((CBotVarArray*)var)->GetItem(0,true); // gets the component [0] var = (static_cast<CBotVarArray*>(var))->GetItem(0,true); // gets the component [0]
if (i->m_expr == NULL) if (i->m_expr == NULL)
{ {
@ -2577,15 +2578,15 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack)
} }
if (pStk->IsOk()) return (CBotLeftExpr*) pStack->Return(inst, pStk); if (pStk->IsOk()) return static_cast<CBotLeftExpr*> (pStack->Return(inst, pStk));
} }
pStk->SetError(TX_UNDEFVAR, p); pStk->SetError(TX_UNDEFVAR, p);
err: err:
delete inst; delete inst;
return (CBotLeftExpr*) pStack->Return(NULL, pStk); return static_cast<CBotLeftExpr*> ( pStack->Return(NULL, pStk));
} }
return (CBotLeftExpr*) pStack->Return(NULL, pStk); return static_cast<CBotLeftExpr*> ( pStack->Return(NULL, pStk));
} }
// runs, is a variable and assigns the result to the stack // runs, is a variable and assigns the result to the stack
@ -2768,7 +2769,7 @@ extern float GetNumFloat(const char* p)
} }
if (bNeg) num = -num; if (bNeg) num = -num;
return (float)num; return static_cast<float>(num);
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -2814,7 +2815,7 @@ CBotInstr* CBotExprNum::Compile(CBotToken* &p, CBotCStack* pStack)
if (pStk->NextToken(p)) if (pStk->NextToken(p))
{ {
CBotVar* var = CBotVar::Create((CBotToken*)NULL, inst->m_numtype); CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), inst->m_numtype);
pStk->SetVar(var); pStk->SetVar(var);
return pStack->Return(inst, pStk); return pStack->Return(inst, pStk);
@ -2831,7 +2832,7 @@ bool CBotExprNum::Execute(CBotStack* &pj)
if (pile->IfStep()) return false; if (pile->IfStep()) return false;
CBotVar* var = CBotVar::Create((CBotToken*)NULL, m_numtype); CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), m_numtype);
CBotString nombre ; CBotString nombre ;
if (m_token.GetType() == TokenTypDef) if (m_token.GetType() == TokenTypDef)
@ -2883,7 +2884,7 @@ CBotInstr* CBotExprAlpha::Compile(CBotToken* &p, CBotCStack* pStack)
inst->SetToken(p); inst->SetToken(p);
p = p->GetNext(); p = p->GetNext();
CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypString); CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypString);
pStk->SetVar(var); pStk->SetVar(var);
return pStack->Return(inst, pStk); return pStack->Return(inst, pStk);
@ -2897,7 +2898,7 @@ bool CBotExprAlpha::Execute(CBotStack* &pj)
if (pile->IfStep()) return false; if (pile->IfStep()) return false;
CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypString); CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypString);
CBotString chaine = m_token.GetString(); CBotString chaine = m_token.GetString();
chaine = chaine.Mid(1, chaine.GetLength()-2); // removes the quotes chaine = chaine.Mid(1, chaine.GetLength()-2); // removes the quotes
@ -2941,7 +2942,7 @@ CBotInstr* CBotExprBool::Compile(CBotToken* &p, CBotCStack* pStack)
inst->SetToken(p); // stores the operation false or true inst->SetToken(p); // stores the operation false or true
p = p->GetNext(); p = p->GetNext();
CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypBoolean); CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypBoolean);
pStk->SetVar(var); pStk->SetVar(var);
} }
@ -2956,7 +2957,7 @@ bool CBotExprBool::Execute(CBotStack* &pj)
if (pile->IfStep()) return false; if (pile->IfStep()) return false;
CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypBoolean); CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypBoolean);
if (GetTokenType() == ID_TRUE) var->SetValInt(1); if (GetTokenType() == ID_TRUE) var->SetValInt(1);
else var->SetValInt(0); else var->SetValInt(0);
@ -2990,7 +2991,7 @@ bool CBotExprNull::Execute(CBotStack* &pj)
CBotStack* pile = pj->AddStack(this); CBotStack* pile = pj->AddStack(this);
if (pile->IfStep()) return false; if (pile->IfStep()) return false;
CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypNullPointer); CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypNullPointer);
var->SetInit(true); // null pointer valid var->SetInit(true); // null pointer valid
pile->SetVar(var); // place on the stack pile->SetVar(var); // place on the stack
@ -3022,7 +3023,7 @@ bool CBotExprNan::Execute(CBotStack* &pj)
CBotStack* pile = pj->AddStack(this); CBotStack* pile = pj->AddStack(this);
if (pile->IfStep()) return false; if (pile->IfStep()) return false;
CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypInt); CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypInt);
var->SetInit(IS_NAN); // nan var->SetInit(IS_NAN); // nan
pile->SetVar(var); // put on the stack pile->SetVar(var); // put on the stack
@ -3051,7 +3052,7 @@ CBotExprVar::~CBotExprVar()
CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat) CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat)
{ {
CBotToken* pDebut = p; // CBotToken* pDebut = p;
CBotCStack* pStk = pStack->TokenStack(); CBotCStack* pStk = pStack->TokenStack();
pStk->SetStartError(p->GetStart()); pStk->SetStartError(p->GetStart());
@ -3068,7 +3069,7 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat)
if (NULL != (var = pStk->FindVar(p))) // seek if known variable if (NULL != (var = pStk->FindVar(p))) // seek if known variable
{ {
int ident = var->GetUniqNum(); int ident = var->GetUniqNum();
((CBotExprVar*)inst)->m_nIdent = ident; // identifies variable by its number (static_cast<CBotExprVar*>(inst))->m_nIdent = ident; // identifies variable by its number
if (ident > 0 && ident < 9000) if (ident > 0 && ident < 9000)
{ {
@ -3085,7 +3086,7 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat)
///tests ///tests
CBotToken token("this"); CBotToken token("this");
inst->SetToken(&token); inst->SetToken(&token);
((CBotExprVar*)inst)->m_nIdent = -2; // identificator for this (static_cast<CBotExprVar*>(inst))->m_nIdent = -2; // identificator for this
CBotFieldExpr* i = new CBotFieldExpr(); // new element CBotFieldExpr* i = new CBotFieldExpr(); // new element
i->SetToken(p); // keeps the name of the token i->SetToken(p); // keeps the name of the token
@ -3105,7 +3106,7 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat)
i->m_expr = CBotExpression::Compile(p, pStk); // compile the formula i->m_expr = CBotExpression::Compile(p, pStk); // compile the formula
inst->AddNext3(i); // add to the chain inst->AddNext3(i); // add to the chain
var = ((CBotVarArray*)var)->GetItem(0,true); // gets the component [0] var = (static_cast<CBotVarArray*>(var))->GetItem(0,true); // gets the component [0]
if (i->m_expr == NULL) if (i->m_expr == NULL)
{ {
@ -3202,7 +3203,7 @@ CBotInstr* CBotExprVar::CompileMethode(CBotToken* &p, CBotCStack* pStack)
// adds the equivalent of this. before // adds the equivalent of this. before
inst->SetToken(&pthis); inst->SetToken(&pthis);
((CBotExprVar*)inst)->m_nIdent = -2; // ident for this (static_cast<CBotExprVar*>(inst))->m_nIdent = -2; // ident for this
CBotToken* pp = p; CBotToken* pp = p;
@ -3555,9 +3556,9 @@ void CBotInstrMethode::RestoreStateVar(CBotStack* &pile, bool bMain)
ppVars[i] = NULL; ppVars[i] = NULL;
CBotClass* pClass = CBotClass::Find(m_ClassName); CBotClass* pClass = CBotClass::Find(m_ClassName);
CBotVar* pResult = NULL; // CBotVar* pResult = NULL;
CBotVar* pRes = pResult; // CBotVar* pRes = pResult;
pClass->RestoreMethode(m_MethodeIdent, m_NomMethod, pClass->RestoreMethode(m_MethodeIdent, m_NomMethod,
pThis, ppVars, pile2); pThis, ppVars, pile2);

View File

@ -29,7 +29,7 @@
#define STACKMEM true /// \def preserve memory for the execution stack #define STACKMEM true /// \def preserve memory for the execution stack
#define MAXSTACK 990 /// \def stack size reserved #define MAXSTACK 990 /// \def stack size reserved
#define EOX (CBotStack*)-1 /// \def tag special condition #define EOX (reinterpret_cast<CBotStack*>(-1)) /// \def tag special condition
// fix for MSVC instruction __asm int 3 (setting a trap) // fix for MSVC instruction __asm int 3 (setting a trap)

View File

@ -488,7 +488,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
bool bIntrinsic = pClass->IsIntrinsic(); bool bIntrinsic = pClass->IsIntrinsic();
CBotTypResult type = CBotTypResult( bIntrinsic ? CBotTypIntrinsic : CBotTypPointer, pClass ); CBotTypResult type = CBotTypResult( bIntrinsic ? CBotTypIntrinsic : CBotTypPointer, pClass );
CBotClassInst* inst = (CBotClassInst*)CompileArray(p, pStack, type); CBotClassInst* inst = static_cast<CBotClassInst*>(CompileArray(p, pStack, type));
if ( inst != NULL || !pStack->IsOk() ) return inst; if ( inst != NULL || !pStack->IsOk() ) return inst;
CBotCStack* pStk = pStack->TokenStack(); CBotCStack* pStk = pStack->TokenStack();
@ -501,7 +501,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
if ( NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk )) ) if ( NULL != (inst->m_var = CBotLeftExprVar::Compile( p, pStk )) )
{ {
((CBotLeftExprVar*)inst->m_var)->m_typevar = type; (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = type;
if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable
{ {
pStk->SetStartError(vartoken->GetStart()); pStk->SetStartError(vartoken->GetStart());
@ -516,7 +516,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
// compiles declaration an array // compiles declaration an array
inst = (CBotClassInst*)CBotInstArray::Compile( p, pStk, type ); inst = static_cast<CBotClassInst*>(CBotInstArray::Compile( p, pStk, type ));
if (!pStk->IsOk() ) if (!pStk->IsOk() )
{ {
@ -531,7 +531,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
var = CBotVar::Create(vartoken->GetString(), type); // creates the instance var = CBotVar::Create(vartoken->GetString(), type); // creates the instance
// var->SetClass(pClass); // var->SetClass(pClass);
var->SetUniqNum( var->SetUniqNum(
((CBotLeftExprVar*)inst->m_var)->m_nIdent = CBotVar::NextUniqNum()); (static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
// its attribute a unique number // its attribute a unique number
pStack->AddVar(var); // placed on the stack pStack->AddVar(var); // placed on the stack
@ -667,12 +667,12 @@ bool CBotClassInst::Execute(CBotStack* &pj)
pThis = CBotVar::Create(name, CBotTypResult( CBotTypPointer, pClass )); pThis = CBotVar::Create(name, CBotTypResult( CBotTypPointer, pClass ));
} }
pThis->SetUniqNum(((CBotLeftExprVar*)m_var)->m_nIdent); // its attribute as unique number pThis->SetUniqNum((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent); // its attribute as unique number
pile->AddVar(pThis); // place on the stack pile->AddVar(pThis); // place on the stack
pile->IncState(); pile->IncState();
} }
if ( pThis == NULL ) pThis = pile->FindVar(((CBotLeftExprVar*)m_var)->m_nIdent); if ( pThis == NULL ) pThis = pile->FindVar((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent);
if ( pile->GetState()<3) if ( pile->GetState()<3)
{ {
@ -698,7 +698,7 @@ bool CBotClassInst::Execute(CBotStack* &pj)
else else
{ {
CBotVarClass* pInstance; CBotVarClass* pInstance;
pInstance = ((CBotVarPointer*)pile->GetVar())->GetPointer(); // value for the assignment pInstance = (static_cast<CBotVarPointer*>(pile->GetVar()))->GetPointer(); // value for the assignment
pThis->SetPointer(pInstance); pThis->SetPointer(pInstance);
} }
pThis->SetInit(true); pThis->SetInit(true);
@ -716,7 +716,7 @@ bool CBotClassInst::Execute(CBotStack* &pj)
// creates an instance of the requested class // creates an instance of the requested class
CBotVarClass* pInstance; CBotVarClass* pInstance;
pInstance = (CBotVarClass*)CBotVar::Create("", pClass); pInstance = static_cast<CBotVarClass*>(CBotVar::Create("", pClass));
pThis->SetPointer(pInstance); pThis->SetPointer(pInstance);
delete pInstance; delete pInstance;
@ -789,7 +789,7 @@ void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain)
{ {
CBotString name = m_var->m_token.GetString(); CBotString name = m_var->m_token.GetString();
pThis = pile->FindVar(name); pThis = pile->FindVar(name);
pThis->SetUniqNum(((CBotLeftExprVar*)m_var)->m_nIdent); // its attribute a unique number pThis->SetUniqNum((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent); // its attribute a unique number
} }
CBotToken* pt = &m_token; CBotToken* pt = &m_token;
@ -845,7 +845,7 @@ void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain)
ppVars[i] = NULL; ppVars[i] = NULL;
// creates a variable for the result // creates a variable for the result
CBotVar* pResult = NULL; // constructor still void // CBotVar* pResult = NULL; // constructor still void
pClass->RestoreMethode(m_nMethodeIdent, pClass->GetName(), pThis, ppVars, pile2); pClass->RestoreMethode(m_nMethodeIdent, pClass->GetName(), pThis, ppVars, pile2);
return; return;

View File

@ -77,9 +77,10 @@ enum CBotType
//n = not implemented yet //n = not implemented yet
// for SetUserPtr when deleting an object // for SetUserPtr when deleting an object
#define OBJECTDELETED ((void*)-1) // \TODO define own types to distinct between different states of objects
#define OBJECTDELETED (reinterpret_cast<void*>(-1))
// value set before initialization // value set before initialization
#define OBJECTCREATED ((void*)-2) #define OBJECTCREATED (reinterpret_cast<void*>(-2))
/** \brief CBotTypResult class to define the complete type of a result*/ /** \brief CBotTypResult class to define the complete type of a result*/
@ -314,7 +315,7 @@ private:
int m_lg; int m_lg;
/** \brief Keeps the string corresponding to keyword ID */ /** \brief Keeps the string corresponding to keyword ID */
static const std::map<EID, char *> s_keywordString; static const std::map<EID,const char *> s_keywordString;
/** /**
* \brief MapIdToString maps given ID to its string equivalent * \brief MapIdToString maps given ID to its string equivalent

View File

@ -462,7 +462,8 @@ CBotTypResult CBotFunction::CompileCall(const char* name, CBotVar** ppVars, long
nIdent = 0; nIdent = 0;
CBotTypResult type; CBotTypResult type;
CBotFunction* pt = FindLocalOrPublic(nIdent, name, ppVars, type); // CBotFunction* pt = FindLocalOrPublic(nIdent, name, ppVars, type);
FindLocalOrPublic(nIdent, name, ppVars, type);
return type; return type;
} }
@ -731,7 +732,7 @@ void CBotFunction::RestoreCall(long& nIdent, const char* name, CBotVar** ppVars,
{ {
if ( !pt->m_MasterClass.IsEmpty() ) if ( !pt->m_MasterClass.IsEmpty() )
{ {
CBotVar* pInstance = m_pProg->m_pInstance; // CBotVar* pInstance = m_pProg->m_pInstance;
// make "this" known // make "this" known
CBotVar* pThis = pStk1->FindVar("this"); CBotVar* pThis = pStk1->FindVar("this");
pThis->SetInit(2); pThis->SetInit(2);
@ -957,7 +958,7 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
if (list == NULL) list = param; if (list == NULL) list = param;
else list->AddNext(param); // added to the list else list->AddNext(param); // added to the list
CBotClass* pClass = NULL;//= CBotClass::Find(p); // CBotClass* pClass = NULL;//= CBotClass::Find(p);
param->m_typename = p->GetString(); param->m_typename = p->GetString();
CBotTypResult type = param->m_type = TypeParam(p, pStack); CBotTypResult type = param->m_type = TypeParam(p, pStack);
// if ( type == CBotTypPointer ) type = CBotTypClass; // we must create a new object // if ( type == CBotTypPointer ) type = CBotTypClass; // we must create a new object
@ -1036,7 +1037,7 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
newvar->SetValInt(ppVars[i]->GetValInt()); newvar->SetValInt(ppVars[i]->GetValInt());
break; break;
case CBotTypIntrinsic: case CBotTypIntrinsic:
((CBotVarClass*)newvar)->Copy(ppVars[i], false); (static_cast<CBotVarClass*>(newvar))->Copy(ppVars[i], false);
break; break;
case CBotTypPointer: case CBotTypPointer:
case CBotTypArrayPointer: case CBotTypArrayPointer:
@ -1059,7 +1060,7 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
void CBotDefParam::RestoreState(CBotStack* &pj, bool bMain) void CBotDefParam::RestoreState(CBotStack* &pj, bool bMain)
{ {
int i = 0; // int i = 0;
CBotDefParam* p = this; CBotDefParam* p = this;
while ( p != NULL ) while ( p != NULL )
@ -1287,7 +1288,7 @@ bool CBotInstrCall::Execute(CBotStack* &pj)
CBotStack* pile = pj->AddStack(this); CBotStack* pile = pj->AddStack(this);
if ( pile->StackOver() ) return pj->Return( pile ); if ( pile->StackOver() ) return pj->Return( pile );
CBotStack* pile1 = pile; // CBotStack* pile1 = pile;
int i = 0; int i = 0;
@ -1324,7 +1325,7 @@ void CBotInstrCall::RestoreState(CBotStack* &pj, bool bMain)
CBotStack* pile = pj->RestoreStack(this); CBotStack* pile = pj->RestoreStack(this);
if ( pile == NULL ) return; if ( pile == NULL ) return;
CBotStack* pile1 = pile; // CBotStack* pile1 = pile;
int i = 0; int i = 0;
CBotVar* ppVars[1000]; CBotVar* ppVars[1000];

View File

@ -487,7 +487,7 @@ bool ReadType(FILE* pf, CBotTypResult& type)
if ( !ReadWord(pf, ww) ) return false; if ( !ReadWord(pf, ww) ) return false;
if ( !ReadType(pf, r) ) return false; if ( !ReadType(pf, r) ) return false;
type = CBotTypResult( w, r ); type = CBotTypResult( w, r );
type.SetLimite((short)ww); type.SetLimite(static_cast<short>(ww));
} }
return true; return true;
} }
@ -625,7 +625,7 @@ CBotVar* MakeListVars(CBotVar** ppVars, bool bSetVal=false)
while( true ) while( true )
{ {
ppVars[i]; // ppVars[i];
if ( ppVars[i] == NULL ) break; if ( ppVars[i] == NULL ) break;
CBotVar* pp = CBotVar::Create(ppVars[i]); CBotVar* pp = CBotVar::Create(ppVars[i]);
@ -781,7 +781,7 @@ fund:
// lists the parameters depending on the contents of the stack (pStackVar) // lists the parameters depending on the contents of the stack (pStackVar)
CBotVar* pVar = MakeListVars(ppVar, true); CBotVar* pVar = MakeListVars(ppVar, true);
CBotVar* pVarToDelete = pVar; // CBotVar* pVarToDelete = pVar;
// creates a variable to the result // creates a variable to the result
CBotVar* pResult = rettype.Eq(0) ? NULL : CBotVar::Create("", rettype); CBotVar* pResult = rettype.Eq(0) ? NULL : CBotVar::Create("", rettype);
@ -815,7 +815,8 @@ bool CBotCall::RestoreCall(long& nIdent, CBotToken* token, CBotVar** ppVar, CBot
CBotStack* pile = pStack->RestoreStackEOX(pt); CBotStack* pile = pStack->RestoreStackEOX(pt);
if ( pile == NULL ) return true; if ( pile == NULL ) return true;
CBotStack* pile2 = pile->RestoreStack(); // CBotStack* pile2 = pile->RestoreStack();
pile->RestoreStack();
return true; return true;
} }
pt = pt->m_next; pt = pt->m_next;

View File

@ -47,7 +47,7 @@ CBotStack* CBotStack::FirstStack()
size *= (MAXSTACK+10); size *= (MAXSTACK+10);
// request a slice of memory for the stack // request a slice of memory for the stack
p = (CBotStack*)malloc(size); p = static_cast<CBotStack*>(malloc(size));
// completely empty // completely empty
memset(p, 0, size); memset(p, 0, size);
@ -905,7 +905,7 @@ bool CBotStack::RestoreState(FILE* pf, CBotStack* &pStack)
pStack->m_bBlock = w; pStack->m_bBlock = w;
if (!ReadWord(pf, w)) return false; // in what state ? if (!ReadWord(pf, w)) return false; // in what state ?
pStack->SetState((short)w); // in a good state pStack->SetState(static_cast<short>(w)); // in a good state
if (!ReadWord(pf, w)) return false; // dont delete? if (!ReadWord(pf, w)) return false; // dont delete?
// uses more // uses more
@ -1016,7 +1016,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
case CBotTypBoolean: case CBotTypBoolean:
pNew = CBotVar::Create(&token, w); // creates a variable pNew = CBotVar::Create(&token, w); // creates a variable
if (!ReadWord(pf, w)) return false; if (!ReadWord(pf, w)) return false;
pNew->SetValInt((short)w, defnum); pNew->SetValInt(static_cast<short>(w), defnum);
break; break;
case CBotTypFloat: case CBotTypFloat:
pNew = CBotVar::Create(&token, w); // creates a variable pNew = CBotVar::Create(&token, w); // creates a variable
@ -1045,7 +1045,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
pNew = new CBotVarClass(&token, r); // directly creates an instance pNew = new CBotVarClass(&token, r); // directly creates an instance
// attention cptuse = 0 // attention cptuse = 0
if ( !RestoreState(pf, ((CBotVarClass*)pNew)->m_pVar)) return false; if ( !RestoreState(pf, (static_cast<CBotVarClass*>(pNew))->m_pVar)) return false;
pNew->SetIdent(id); pNew->SetIdent(id);
if ( p != NULL ) if ( p != NULL )
@ -1062,7 +1062,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
if (!ReadString(pf, s)) return false; if (!ReadString(pf, s)) return false;
{ {
pNew = CBotVar::Create(&token, CBotTypResult(w, s));// creates a variable pNew = CBotVar::Create(&token, CBotTypResult(w, s));// creates a variable
CBotVarClass* p = NULL; // CBotVarClass* p = NULL;
long id; long id;
ReadLong(pf, id); ReadLong(pf, id);
// if ( id ) p = CBotVarClass::Find(id); // found the instance (made by RestoreInstance) // if ( id ) p = CBotVarClass::Find(id); // found the instance (made by RestoreInstance)
@ -1070,9 +1070,9 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
// returns a copy of the original instance // returns a copy of the original instance
CBotVar* pInstance = NULL; CBotVar* pInstance = NULL;
if ( !CBotVar::RestoreState( pf, pInstance ) ) return false; if ( !CBotVar::RestoreState( pf, pInstance ) ) return false;
((CBotVarPointer*)pNew)->SetPointer( pInstance ); // and point over (static_cast<CBotVarPointer*>(pNew))->SetPointer( pInstance ); // and point over
// if ( p != NULL ) ((CBotVarPointer*)pNew)->SetPointer( p ); // rather this one // if ( p != NULL ) (static_cast<CBotVarPointer*>(pNew))->SetPointer( p ); // rather this one
} }
break; break;
@ -1087,7 +1087,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
// returns a copy of the original instance // returns a copy of the original instance
CBotVar* pInstance = NULL; CBotVar* pInstance = NULL;
if ( !CBotVar::RestoreState( pf, pInstance ) ) return false; if ( !CBotVar::RestoreState( pf, pInstance ) ) return false;
((CBotVarPointer*)pNew)->SetPointer( pInstance ); // and point over (static_cast<CBotVarPointer*>(pNew))->SetPointer( pInstance ); // and point over
} }
break; break;
default: default:

View File

@ -24,7 +24,7 @@
#include <algorithm> #include <algorithm>
//Map is filled with id-string pars that are needed for CBot language parsing //Map is filled with id-string pars that are needed for CBot language parsing
const std::map<EID, char *> CBotString::s_keywordString = const std::map<EID,const char *> CBotString::s_keywordString =
{ {
{ID_IF, "if"}, {ID_IF, "if"},
{ID_ELSE, "else"}, {ID_ELSE, "else"},
@ -170,7 +170,7 @@ CBotString CBotString::Left(int nCount) const
{ {
char chain[2000]; char chain[2000];
size_t i; int i;
for (i = 0; i < m_lg && i < nCount && i < 1999; ++i) for (i = 0; i < m_lg && i < nCount && i < 1999; ++i)
{ {
chain[i] = m_ptr[i]; chain[i] = m_ptr[i];
@ -187,8 +187,8 @@ CBotString CBotString::Right(int nCount) const
int i = m_lg - nCount; int i = m_lg - nCount;
if ( i < 0 ) i = 0; if ( i < 0 ) i = 0;
size_t j; int j;
for (size_t j = 0 ; i < m_lg && i < 1999; ++i) for (int j = 0 ; i < m_lg && i < 1999; ++i)
{ {
chain[j++] = m_ptr[i]; chain[j++] = m_ptr[i];
} }
@ -201,7 +201,7 @@ CBotString CBotString::Mid(int nFirst, int nCount) const
{ {
char chain[2000]; char chain[2000];
size_t i; int i;
for (i = nFirst; i < m_lg && i < 1999 && i <= nFirst + nCount; ++i) for (i = nFirst; i < m_lg && i < 1999 && i <= nFirst + nCount; ++i)
{ {
chain[i] = m_ptr[i]; chain[i] = m_ptr[i];
@ -215,7 +215,7 @@ CBotString CBotString::Mid(int nFirst) const
{ {
char chain[2000]; char chain[2000];
size_t i; int i;
for (i = nFirst; i < m_lg && i < 1999 ; ++i) for (i = nFirst; i < m_lg && i < 1999 ; ++i)
{ {
chain[i] = m_ptr[i]; chain[i] = m_ptr[i];
@ -228,7 +228,7 @@ CBotString CBotString::Mid(int nFirst) const
int CBotString::Find(const char c) int CBotString::Find(const char c)
{ {
for (size_t i = 0; i < m_lg; ++i) for (int i = 0; i < m_lg; ++i)
{ {
if (m_ptr[i] == c) return i; if (m_ptr[i] == c) return i;
} }
@ -239,9 +239,9 @@ int CBotString::Find(const char * lpsz)
{ {
int l = strlen(lpsz); int l = strlen(lpsz);
for (size_t i = 0; i <= m_lg-l; ++i) for (size_t i = 0; static_cast<int>(i) <= m_lg-l; ++i)
{ {
for (size_t j = 0; j < l; ++j) for (size_t j = 0; static_cast<int>(j) < l; ++j)
{ {
if (m_ptr[i+j] != lpsz[j]) goto bad; if (m_ptr[i+j] != lpsz[j]) goto bad;
} }
@ -296,7 +296,7 @@ CBotString CBotString::Mid(int start, int lg)
void CBotString::MakeUpper() void CBotString::MakeUpper()
{ {
for (size_t i = 0; i < m_lg && i < 1999 ; ++i) for (size_t i = 0; static_cast<int>(i) < m_lg && static_cast<int>(i) < 1999 ; ++i)
{ {
char c = m_ptr[i]; char c = m_ptr[i];
if ( c >= 'a' && c <= 'z' ) m_ptr[i] = c - 'a' + 'A'; if ( c >= 'a' && c <= 'z' ) m_ptr[i] = c - 'a' + 'A';
@ -305,7 +305,7 @@ void CBotString::MakeUpper()
void CBotString::MakeLower() void CBotString::MakeLower()
{ {
for (size_t i = 0; i < m_lg && i < 1999 ; ++i) for (size_t i = 0; static_cast<int>(i) < m_lg && static_cast<int>(i) < 1999 ; ++i)
{ {
char c = m_ptr[i]; char c = m_ptr[i];
if ( c >= 'A' && c <= 'Z' ) m_ptr[i] = c - 'A' + 'a'; if ( c >= 'A' && c <= 'Z' ) m_ptr[i] = c - 'A' + 'a';
@ -315,7 +315,7 @@ void CBotString::MakeLower()
bool CBotString::LoadString(unsigned int id) bool CBotString::LoadString(unsigned int id)
{ {
const char * str = NULL; const char * str = NULL;
str = MapIdToString((EID)id); str = MapIdToString(static_cast<EID>(id));
if (m_ptr != NULL) free(m_ptr); if (m_ptr != NULL) free(m_ptr);
m_lg = strlen(str); m_lg = strlen(str);
@ -374,7 +374,7 @@ const CBotString& CBotString::operator=(const char ch)
m_lg = 1; m_lg = 1;
m_ptr = (char*)malloc(2); m_ptr = static_cast<char*>(malloc(2));
m_ptr[0] = ch; m_ptr[0] = ch;
m_ptr[1] = 0; m_ptr[1] = 0;
@ -403,7 +403,7 @@ const CBotString& CBotString::operator=(const char* pString)
const CBotString& CBotString::operator+=(const char ch) const CBotString& CBotString::operator+=(const char ch)
{ {
char* p = (char*)malloc(m_lg+2); char* p = static_cast<char*>(malloc(m_lg+2));
if (m_ptr!=NULL) strcpy(p, m_ptr); if (m_ptr!=NULL) strcpy(p, m_ptr);
p[m_lg++] = ch; p[m_lg++] = ch;
@ -418,7 +418,7 @@ const CBotString& CBotString::operator+=(const char ch)
const CBotString& CBotString::operator+=(const CBotString& str) const CBotString& CBotString::operator+=(const CBotString& str)
{ {
char* p = (char*)malloc(m_lg+str.m_lg+1); char* p = static_cast<char*>(malloc(m_lg+str.m_lg+1));
strcpy(p, m_ptr); strcpy(p, m_ptr);
char* pp = p + m_lg; char* pp = p + m_lg;
@ -618,6 +618,7 @@ void CBotStringArray::SetSize(int nNewSize)
// shrink to nothing // shrink to nothing
DestructElements(m_pData, m_nSize); DestructElements(m_pData, m_nSize);
// delete[] static_cast<unsigned char *>(m_pData);
delete[] (unsigned char *)m_pData; delete[] (unsigned char *)m_pData;
m_pData = NULL; m_pData = NULL;
m_nSize = m_nMaxSize = 0; m_nSize = m_nMaxSize = 0;

View File

@ -217,12 +217,12 @@ bool Char2InList(const char c, const char cc, const char* list)
} }
} }
static char* sep1 = " \r\n\t,:()[]{}-+*/=;><!~^|&%."; static char sep1[] = " \r\n\t,:()[]{}-+*/=;><!~^|&%.";
static char* sep2 = " \r\n\t"; // only separators static char sep2[] = " \r\n\t"; // only separators
static char* sep3 = ",:()[]{}-+*/=;<>!~^|&%."; // operational separators static char sep3[] = ",:()[]{}-+*/=;<>!~^|&%."; // operational separators
static char* num = "0123456789"; // point (single) is tested separately static char num[] = "0123456789"; // point (single) is tested separately
static char* hexnum = "0123456789ABCDEFabcdef"; static char hexnum[] = "0123456789ABCDEFabcdef";
static char* nch = "\"\r\n\t"; // forbidden in chains static char nch[] = "\"\r\n\t"; // forbidden in chains
//static char* duo = "+=-=*=/===!=<=>=++--///**/||&&"; // double operators //static char* duo = "+=-=*=/===!=<=>=++--///**/||&&"; // double operators
@ -382,7 +382,7 @@ bis:
CBotToken* CBotToken::CompileTokens(const char* program, int& error) CBotToken* CBotToken::CompileTokens(const char* program, int& error)
{ {
CBotToken *nxt, *prv, *tokenbase; CBotToken *nxt, *prv, *tokenbase;
char* p = (char*) program; char* p = const_cast<char*> ( program);
int pos = 0; int pos = 0;
error = 0; error = 0;

View File

@ -259,7 +259,7 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera
CBotTypResult t(type1); CBotTypResult t(type1);
t.SetType(TypeRes); t.SetType(TypeRes);
// is a variable on the stack for the type of result // is a variable on the stack for the type of result
pStk->SetVar(CBotVar::Create((CBotToken*)NULL, t)); pStk->SetVar(CBotVar::Create(static_cast<CBotToken*>(NULL), t));
// and returns the requested object // and returns the requested object
return pStack->Return(inst, pStk); return pStack->Return(inst, pStk);
@ -309,14 +309,14 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
// for OR and AND logic does not evaluate the second expression if not necessary // for OR and AND logic does not evaluate the second expression if not necessary
if ( (GetTokenType() == ID_LOG_AND || GetTokenType() == ID_TXT_AND ) && pStk1->GetVal() == false ) if ( (GetTokenType() == ID_LOG_AND || GetTokenType() == ID_TXT_AND ) && pStk1->GetVal() == false )
{ {
CBotVar* res = CBotVar::Create( (CBotToken*)NULL, CBotTypBoolean); CBotVar* res = CBotVar::Create( static_cast<CBotToken*>(NULL), CBotTypBoolean);
res->SetValInt(false); res->SetValInt(false);
pStk1->SetVar(res); pStk1->SetVar(res);
return pStack->Return(pStk1); // transmits the result return pStack->Return(pStk1); // transmits the result
} }
if ( (GetTokenType() == ID_LOG_OR||GetTokenType() == ID_TXT_OR) && pStk1->GetVal() == true ) if ( (GetTokenType() == ID_LOG_OR||GetTokenType() == ID_TXT_OR) && pStk1->GetVal() == true )
{ {
CBotVar* res = CBotVar::Create( (CBotToken*)NULL, CBotTypBoolean); CBotVar* res = CBotVar::Create( static_cast<CBotToken*>(NULL), CBotTypBoolean);
res->SetValInt(true); res->SetValInt(true);
pStk1->SetVar(res); pStk1->SetVar(res);
return pStack->Return(pStk1); // transmits the result return pStack->Return(pStk1); // transmits the result
@ -374,7 +374,7 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
} }
// creates a variable for the result // creates a variable for the result
CBotVar* result = CBotVar::Create( (CBotToken*)NULL, TypeRes); CBotVar* result = CBotVar::Create( static_cast<CBotToken*>(NULL), TypeRes);
// creates a variable to perform the calculation in the appropriate type // creates a variable to perform the calculation in the appropriate type
TypeRes = MAX(type1.GetType(), type2.GetType()); TypeRes = MAX(type1.GetType(), type2.GetType());
@ -387,8 +387,8 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
CBotVar* temp; CBotVar* temp;
if ( TypeRes == CBotTypPointer ) TypeRes = CBotTypNullPointer; if ( TypeRes == CBotTypPointer ) TypeRes = CBotTypNullPointer;
if ( TypeRes == CBotTypClass ) temp = CBotVar::Create( (CBotToken*)NULL, CBotTypResult(CBotTypIntrinsic, type1.GetClass() ) ); if ( TypeRes == CBotTypClass ) temp = CBotVar::Create( static_cast<CBotToken*>(NULL), CBotTypResult(CBotTypIntrinsic, type1.GetClass() ) );
else temp = CBotVar::Create( (CBotToken*)NULL, TypeRes ); else temp = CBotVar::Create( static_cast<CBotToken*>(NULL), TypeRes );
int err = 0; int err = 0;
// is a operation according to request // is a operation according to request
@ -558,7 +558,7 @@ void t()
} }
#endif #endif
#if 01 #if 0
void t(bool t) void t(bool t)
{ {
int x; int x;

View File

@ -203,13 +203,13 @@ CBotVar::~CBotVar( )
void CBotVar::debug() void CBotVar::debug()
{ {
const char* p = (const char*) m_token->GetString(); // const char* p = static_cast<const char*>( m_token->GetString());
CBotString s = (const char*) GetValString(); CBotString s = static_cast<const char*>( GetValString());
const char* v = (const char*) s; // const char* v = static_cast<const char*> (s);
if ( m_type.Eq(CBotTypClass) ) if ( m_type.Eq(CBotTypClass) )
{ {
CBotVar* pv = ((CBotVarClass*)this)->m_pVar; CBotVar* pv = (static_cast<CBotVarClass*>(this))->m_pVar;
while (pv != NULL) while (pv != NULL)
{ {
pv->debug(); pv->debug();
@ -227,15 +227,15 @@ void CBotVar::SetUserPtr(void* pUser)
{ {
m_pUserPtr = pUser; m_pUserPtr = pUser;
if (m_type.Eq(CBotTypPointer) && if (m_type.Eq(CBotTypPointer) &&
((CBotVarPointer*)this)->m_pVarClass != NULL ) (static_cast<CBotVarPointer*>(this))->m_pVarClass != NULL )
((CBotVarPointer*)this)->m_pVarClass->SetUserPtr(pUser); (static_cast<CBotVarPointer*>(this))->m_pVarClass->SetUserPtr(pUser);
} }
void CBotVar::SetIdent(long n) void CBotVar::SetIdent(long n)
{ {
if (m_type.Eq(CBotTypPointer) && if (m_type.Eq(CBotTypPointer) &&
((CBotVarPointer*)this)->m_pVarClass != NULL ) (static_cast<CBotVarPointer*>(this))->m_pVarClass != NULL )
((CBotVarPointer*)this)->m_pVarClass->SetIdent(n); (static_cast<CBotVarPointer*>(this))->m_pVarClass->SetIdent(n);
} }
void CBotVar::SetUniqNum(long n) void CBotVar::SetUniqNum(long n)
@ -328,7 +328,7 @@ CBotVar* CBotVar::Create(const CBotToken* name, CBotTypResult type)
while (type.Eq(CBotTypArrayBody)) while (type.Eq(CBotTypArrayBody))
{ {
type = type.GetTypElem(); type = type.GetTypElem();
pv = ((CBotVarArray*)pv)->GetItem(0, true); // creates at least the element [0] pv = (static_cast<CBotVarArray*>(pv))->GetItem(0, true); // creates at least the element [0]
} }
return array; return array;
@ -399,7 +399,7 @@ CBotVar* CBotVar::Create( const char* n, CBotTypResult type)
while (type.Eq(CBotTypArrayBody)) while (type.Eq(CBotTypArrayBody))
{ {
type = type.GetTypElem(); type = type.GetTypElem();
pv = ((CBotVarArray*)pv)->GetItem(0, true); // creates at least the element [0] pv = (static_cast<CBotVarArray*>(pv))->GetItem(0, true); // creates at least the element [0]
} }
return array; return array;
@ -484,7 +484,7 @@ void CBotVar::SetInit(int bInit)
if ( instance == NULL ) if ( instance == NULL )
{ {
instance = new CBotVarClass(NULL, m_type); instance = new CBotVarClass(NULL, m_type);
// instance->SetClass(((CBotVarPointer*)this)->m_pClass); // instance->SetClass((static_cast<CBotVarPointer*>(this))->m_pClass);
SetPointer(instance); SetPointer(instance);
} }
instance->SetInit(1); instance->SetInit(1);
@ -492,11 +492,11 @@ void CBotVar::SetInit(int bInit)
if ( m_type.Eq(CBotTypClass) || m_type.Eq(CBotTypIntrinsic) ) if ( m_type.Eq(CBotTypClass) || m_type.Eq(CBotTypIntrinsic) )
{ {
CBotVar* p = ((CBotVarClass*)this)->m_pVar; CBotVar* p = (static_cast<CBotVarClass*>(this))->m_pVar;
while( p != NULL ) while( p != NULL )
{ {
p->SetInit( bInit ); p->SetInit( bInit );
p->m_pMyThis = (CBotVarClass*)this; p->m_pMyThis = static_cast<CBotVarClass*>(this);
p = p->GetNext(); p = p->GetNext();
} }
} }
@ -548,11 +548,11 @@ bool CBotVar::IsElemOfClass(const char* name)
if ( m_type.Eq(CBotTypPointer) ) if ( m_type.Eq(CBotTypPointer) )
{ {
pc = ((CBotVarPointer*)this)->m_pClass; pc = (static_cast<CBotVarPointer*>(this))->m_pClass;
} }
if ( m_type.Eq(CBotTypClass) ) if ( m_type.Eq(CBotTypClass) )
{ {
pc = ((CBotVarClass*)this)->m_pClass; pc = (static_cast<CBotVarClass*>(this))->m_pClass;
} }
while ( pc != NULL ) while ( pc != NULL )
@ -596,7 +596,7 @@ void CBotVar::SetVal(CBotVar* var)
SetValInt(var->GetValInt()); SetValInt(var->GetValInt());
break; break;
case CBotTypInt: case CBotTypInt:
SetValInt(var->GetValInt(), ((CBotVarInt*)var)->m_defnum); SetValInt(var->GetValInt(), (static_cast<CBotVarInt*>(var))->m_defnum);
break; break;
case CBotTypFloat: case CBotTypFloat:
SetValFloat(var->GetValFloat()); SetValFloat(var->GetValFloat());
@ -611,8 +611,8 @@ void CBotVar::SetVal(CBotVar* var)
break; break;
case CBotTypClass: case CBotTypClass:
{ {
delete ((CBotVarClass*)this)->m_pVar; delete (static_cast<CBotVarClass*>(this))->m_pVar;
((CBotVarClass*)this)->m_pVar = NULL; (static_cast<CBotVarClass*>(this))->m_pVar = NULL;
Copy(var, false); Copy(var, false);
} }
break; break;
@ -841,7 +841,7 @@ void CBotVar::SetIndirection(CBotVar* pVar)
// copy a variable in to another // copy a variable in to another
void CBotVarInt::Copy(CBotVar* pSrc, bool bName) void CBotVarInt::Copy(CBotVar* pSrc, bool bName)
{ {
CBotVarInt* p = (CBotVarInt*)pSrc; CBotVarInt* p = static_cast<CBotVarInt*>(pSrc);
if ( bName) *m_token = *p->m_token; if ( bName) *m_token = *p->m_token;
m_type = p->m_type; m_type = p->m_type;
@ -870,7 +870,7 @@ void CBotVarInt::SetValInt(int val, const char* defnum)
void CBotVarInt::SetValFloat(float val) void CBotVarInt::SetValFloat(float val)
{ {
m_val = (int)val; m_val = static_cast<int>(val);
m_binit = true; m_binit = true;
} }
@ -881,7 +881,7 @@ int CBotVarInt::GetValInt()
float CBotVarInt::GetValFloat() float CBotVarInt::GetValFloat()
{ {
return (float)m_val; return static_cast<float>(m_val);
} }
CBotString CBotVarInt::GetValString() CBotString CBotVarInt::GetValString()
@ -917,7 +917,7 @@ void CBotVarInt::Mul(CBotVar* left, CBotVar* right)
void CBotVarInt::Power(CBotVar* left, CBotVar* right) void CBotVarInt::Power(CBotVar* left, CBotVar* right)
{ {
m_val = (int) pow( (double) left->GetValInt() , (double) right->GetValInt() ); m_val = static_cast<int>( pow( static_cast<double>( left->GetValInt()) , static_cast<double>( left->GetValInt()) ));
m_binit = true; m_binit = true;
} }
@ -1052,7 +1052,7 @@ bool CBotVarInt::Ne(CBotVar* left, CBotVar* right)
// copy a variable into another // copy a variable into another
void CBotVarFloat::Copy(CBotVar* pSrc, bool bName) void CBotVarFloat::Copy(CBotVar* pSrc, bool bName)
{ {
CBotVarFloat* p = (CBotVarFloat*)pSrc; CBotVarFloat* p = static_cast<CBotVarFloat*>(pSrc);
if (bName) *m_token = *p->m_token; if (bName) *m_token = *p->m_token;
m_type = p->m_type; m_type = p->m_type;
@ -1072,7 +1072,7 @@ void CBotVarFloat::Copy(CBotVar* pSrc, bool bName)
void CBotVarFloat::SetValInt(int val, const char* s) void CBotVarFloat::SetValInt(int val, const char* s)
{ {
m_val = (float)val; m_val = static_cast<float>(val);
m_binit = true; m_binit = true;
} }
@ -1084,7 +1084,7 @@ void CBotVarFloat::SetValFloat(float val)
int CBotVarFloat::GetValInt() int CBotVarFloat::GetValInt()
{ {
return (int)m_val; return static_cast<int>(m_val);
} }
float CBotVarFloat::GetValFloat() float CBotVarFloat::GetValFloat()
@ -1123,7 +1123,7 @@ void CBotVarFloat::Mul(CBotVar* left, CBotVar* right)
void CBotVarFloat::Power(CBotVar* left, CBotVar* right) void CBotVarFloat::Power(CBotVar* left, CBotVar* right)
{ {
m_val = (float)pow( left->GetValFloat() , right->GetValFloat() ); m_val = static_cast<float>(pow( left->GetValFloat() , right->GetValFloat() ));
m_binit = true; m_binit = true;
} }
@ -1143,7 +1143,7 @@ int CBotVarFloat::Modulo(CBotVar* left, CBotVar* right)
float r = right->GetValFloat(); float r = right->GetValFloat();
if ( r != 0 ) if ( r != 0 )
{ {
m_val = (float)fmod( left->GetValFloat() , r ); m_val = static_cast<float>(fmod( left->GetValFloat() , r ));
m_binit = true; m_binit = true;
} }
return ( r == 0 ? TX_DIVZERO : 0 ); return ( r == 0 ? TX_DIVZERO : 0 );
@ -1213,7 +1213,7 @@ bool CBotVarFloat::Ne(CBotVar* left, CBotVar* right)
// copy a variable into another // copy a variable into another
void CBotVarBoolean::Copy(CBotVar* pSrc, bool bName) void CBotVarBoolean::Copy(CBotVar* pSrc, bool bName)
{ {
CBotVarBoolean* p = (CBotVarBoolean*)pSrc; CBotVarBoolean* p = static_cast<CBotVarBoolean*>(pSrc);
if (bName) *m_token = *p->m_token; if (bName) *m_token = *p->m_token;
m_type = p->m_type; m_type = p->m_type;
@ -1233,13 +1233,13 @@ void CBotVarBoolean::Copy(CBotVar* pSrc, bool bName)
void CBotVarBoolean::SetValInt(int val, const char* s) void CBotVarBoolean::SetValInt(int val, const char* s)
{ {
m_val = (bool)val; m_val = static_cast<bool>(val);
m_binit = true; m_binit = true;
} }
void CBotVarBoolean::SetValFloat(float val) void CBotVarBoolean::SetValFloat(float val)
{ {
m_val = (bool)val; m_val = static_cast<bool>(val);
m_binit = true; m_binit = true;
} }
@ -1250,7 +1250,7 @@ int CBotVarBoolean::GetValInt()
float CBotVarBoolean::GetValFloat() float CBotVarBoolean::GetValFloat()
{ {
return (float)m_val; return static_cast<float>(m_val);
} }
CBotString CBotVarBoolean::GetValString() CBotString CBotVarBoolean::GetValString()
@ -1311,7 +1311,7 @@ bool CBotVarBoolean::Ne(CBotVar* left, CBotVar* right)
// copy a variable into another // copy a variable into another
void CBotVarString::Copy(CBotVar* pSrc, bool bName) void CBotVarString::Copy(CBotVar* pSrc, bool bName)
{ {
CBotVarString* p = (CBotVarString*)pSrc; CBotVarString* p = static_cast<CBotVarString*>(pSrc);
if (bName) *m_token = *p->m_token; if (bName) *m_token = *p->m_token;
m_type = p->m_type; m_type = p->m_type;
@ -1400,7 +1400,7 @@ void CBotVarClass::Copy(CBotVar* pSrc, bool bName)
if ( pSrc->GetType() != CBotTypClass ) if ( pSrc->GetType() != CBotTypClass )
ASM_TRAP(); ASM_TRAP();
CBotVarClass* p = (CBotVarClass*)pSrc; CBotVarClass* p = static_cast<CBotVarClass*>(pSrc);
if (bName) *m_token = *p->m_token; if (bName) *m_token = *p->m_token;
@ -1410,7 +1410,7 @@ void CBotVarClass::Copy(CBotVar* pSrc, bool bName)
m_pClass = p->m_pClass; m_pClass = p->m_pClass;
if ( p->m_pParent ) if ( p->m_pParent )
{ {
ASM_TRAP(); "que faire du pParent"; ASM_TRAP(); // "que faire du pParent";
} }
// m_next = NULL; // m_next = NULL;
@ -1793,7 +1793,7 @@ void CBotVarArray::Copy(CBotVar* pSrc, bool bName)
if ( pSrc->GetType() != CBotTypArrayPointer ) if ( pSrc->GetType() != CBotTypArrayPointer )
ASM_TRAP(); ASM_TRAP();
CBotVarArray* p = (CBotVarArray*)pSrc; CBotVarArray* p = static_cast<CBotVarArray*>(pSrc);
if ( bName) *m_token = *p->m_token; if ( bName) *m_token = *p->m_token;
m_type = p->m_type; m_type = p->m_type;
@ -1827,11 +1827,11 @@ void CBotVarArray::SetPointer(CBotVar* pVarClass)
!pVarClass->m_type.Eq(CBotTypArrayBody)) !pVarClass->m_type.Eq(CBotTypArrayBody))
ASM_TRAP(); ASM_TRAP();
((CBotVarClass*)pVarClass)->IncrementUse(); // incement the reference (static_cast<CBotVarClass*>(pVarClass))->IncrementUse(); // incement the reference
} }
if ( m_pInstance != NULL ) m_pInstance->DecrementUse(); if ( m_pInstance != NULL ) m_pInstance->DecrementUse();
m_pInstance = (CBotVarClass*)pVarClass; m_pInstance = static_cast<CBotVarClass*>(pVarClass);
} }
@ -1967,14 +1967,14 @@ void CBotVarPointer::SetPointer(CBotVar* pVarClass)
if ( !pVarClass->m_type.Eq(CBotTypClass) ) if ( !pVarClass->m_type.Eq(CBotTypClass) )
ASM_TRAP(); ASM_TRAP();
((CBotVarClass*)pVarClass)->IncrementUse(); // increment the reference (static_cast<CBotVarClass*>(pVarClass))->IncrementUse(); // increment the reference
m_pClass = ((CBotVarClass*)pVarClass)->m_pClass; m_pClass = (static_cast<CBotVarClass*>(pVarClass))->m_pClass;
m_pUserPtr = pVarClass->m_pUserPtr; // not really necessary m_pUserPtr = pVarClass->m_pUserPtr; // not really necessary
m_type = CBotTypResult(CBotTypPointer, m_pClass); // what kind of a pointer m_type = CBotTypResult(CBotTypPointer, m_pClass); // what kind of a pointer
} }
if ( m_pVarClass != NULL ) m_pVarClass->DecrementUse(); if ( m_pVarClass != NULL ) m_pVarClass->DecrementUse();
m_pVarClass = (CBotVarClass*)pVarClass; m_pVarClass = static_cast<CBotVarClass*>(pVarClass);
} }
@ -2036,7 +2036,7 @@ void CBotVarPointer::Copy(CBotVar* pSrc, bool bName)
pSrc->GetType() != CBotTypNullPointer) pSrc->GetType() != CBotTypNullPointer)
ASM_TRAP(); ASM_TRAP();
CBotVarPointer* p = (CBotVarPointer*)pSrc; CBotVarPointer* p = static_cast<CBotVarPointer*>(pSrc);
if ( bName) *m_token = *p->m_token; if ( bName) *m_token = *p->m_token;
m_type = p->m_type; m_type = p->m_type;

View File

@ -1132,7 +1132,7 @@ bool CBotTry :: Execute(CBotStack* &pj)
// see what it returns // see what it returns
CBotCatch* pc = m_ListCatch; CBotCatch* pc = m_ListCatch;
int state = (short)pile1->GetState(); // where were we? int state = static_cast<short>(pile1->GetState()); // where were we?
val = pile2->GetState(); // what error? val = pile2->GetState(); // what error?
pile0->SetState(1); // marking the GetRunPos pile0->SetState(1); // marking the GetRunPos
@ -1315,7 +1315,7 @@ bool CBotCatch :: TestCatch(CBotStack* &pile, int val)
if ( val > 0 || pile->GetType() != CBotTypBoolean ) if ( val > 0 || pile->GetType() != CBotTypBoolean )
{ {
CBotVar* var = CBotVar::Create((CBotToken*)NULL, CBotTypBoolean); CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(NULL), CBotTypBoolean);
var->SetValInt( pile->GetVal() == val ); var->SetValInt( pile->GetVal() == val );
pile->SetVar(var); // calls on the stack pile->SetVar(var); // calls on the stack
} }