summaryrefslogtreecommitdiffstats
path: root/src/CBot/CBotClass.cpp
diff options
context:
space:
mode:
authorMichał Konopacki <konopacki.m@gmail.com>2012-08-13 01:26:36 +0200
committerMichał Konopacki <konopacki.m@gmail.com>2012-08-13 01:45:35 +0200
commite154e654f1e046a4d60e09d3ef87d1cf9c3ae6ae (patch)
tree049a2382a5bc8a611fe0ad3df25025eeb7293278 /src/CBot/CBotClass.cpp
parenta9186d19609c61c369d881cdbc40cc8973cf883d (diff)
downloadcolobot-e154e654f1e046a4d60e09d3ef87d1cf9c3ae6ae.tar.gz
colobot-e154e654f1e046a4d60e09d3ef87d1cf9c3ae6ae.tar.bz2
colobot-e154e654f1e046a4d60e09d3ef87d1cf9c3ae6ae.zip
Reduced amount of warnings in CBot library
Changed most of C-style casting to C++ casting Commented unused variables
Diffstat (limited to 'src/CBot/CBotClass.cpp')
-rw-r--r--src/CBot/CBotClass.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/CBot/CBotClass.cpp b/src/CBot/CBotClass.cpp
index 5fac74c..a1c3fd4 100644
--- a/src/CBot/CBotClass.cpp
+++ b/src/CBot/CBotClass.cpp
@@ -488,7 +488,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
bool bIntrinsic = pClass->IsIntrinsic();
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;
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 )) )
{
- ((CBotLeftExprVar*)inst->m_var)->m_typevar = type;
+ (static_cast<CBotLeftExprVar*>(inst->m_var))->m_typevar = type;
if (pStk->CheckVarLocal(vartoken)) // redefinition of the variable
{
pStk->SetStartError(vartoken->GetStart());
@@ -516,7 +516,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
// compiles declaration an array
- inst = (CBotClassInst*)CBotInstArray::Compile( p, pStk, type );
+ inst = static_cast<CBotClassInst*>(CBotInstArray::Compile( p, pStk, type ));
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->SetClass(pClass);
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
pStack->AddVar(var); // placed on the stack
@@ -667,12 +667,12 @@ bool CBotClassInst::Execute(CBotStack* &pj)
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->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)
{
@@ -698,7 +698,7 @@ bool CBotClassInst::Execute(CBotStack* &pj)
else
{
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->SetInit(true);
@@ -716,7 +716,7 @@ bool CBotClassInst::Execute(CBotStack* &pj)
// creates an instance of the requested class
CBotVarClass* pInstance;
- pInstance = (CBotVarClass*)CBotVar::Create("", pClass);
+ pInstance = static_cast<CBotVarClass*>(CBotVar::Create("", pClass));
pThis->SetPointer(pInstance);
delete pInstance;
@@ -789,7 +789,7 @@ void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain)
{
CBotString name = m_var->m_token.GetString();
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;
@@ -845,7 +845,7 @@ void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain)
ppVars[i] = NULL;
// 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);
return;