From e154e654f1e046a4d60e09d3ef87d1cf9c3ae6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Konopacki?= Date: Mon, 13 Aug 2012 01:26:36 +0200 Subject: Reduced amount of warnings in CBot library Changed most of C-style casting to C++ casting Commented unused variables --- src/CBot/CBotStack.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/CBot/CBotStack.cpp') diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp index b6a90c9..67f2000 100644 --- a/src/CBot/CBotStack.cpp +++ b/src/CBot/CBotStack.cpp @@ -47,7 +47,7 @@ CBotStack* CBotStack::FirstStack() size *= (MAXSTACK+10); // request a slice of memory for the stack - p = (CBotStack*)malloc(size); + p = static_cast(malloc(size)); // completely empty memset(p, 0, size); @@ -905,7 +905,7 @@ bool CBotStack::RestoreState(FILE* pf, CBotStack* &pStack) pStack->m_bBlock = w; if (!ReadWord(pf, w)) return false; // in what state ? - pStack->SetState((short)w); // in a good state + pStack->SetState(static_cast(w)); // in a good state if (!ReadWord(pf, w)) return false; // dont delete? // uses more @@ -1016,7 +1016,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar) case CBotTypBoolean: pNew = CBotVar::Create(&token, w); // creates a variable if (!ReadWord(pf, w)) return false; - pNew->SetValInt((short)w, defnum); + pNew->SetValInt(static_cast(w), defnum); break; case CBotTypFloat: 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 // attention cptuse = 0 - if ( !RestoreState(pf, ((CBotVarClass*)pNew)->m_pVar)) return false; + if ( !RestoreState(pf, (static_cast(pNew))->m_pVar)) return false; pNew->SetIdent(id); if ( p != NULL ) @@ -1062,7 +1062,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar) if (!ReadString(pf, s)) return false; { pNew = CBotVar::Create(&token, CBotTypResult(w, s));// creates a variable - CBotVarClass* p = NULL; +// CBotVarClass* p = NULL; long id; ReadLong(pf, id); // 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 CBotVar* pInstance = NULL; if ( !CBotVar::RestoreState( pf, pInstance ) ) return false; - ((CBotVarPointer*)pNew)->SetPointer( pInstance ); // and point over + (static_cast(pNew))->SetPointer( pInstance ); // and point over -// if ( p != NULL ) ((CBotVarPointer*)pNew)->SetPointer( p ); // rather this one +// if ( p != NULL ) (static_cast(pNew))->SetPointer( p ); // rather this one } break; @@ -1087,7 +1087,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar) // returns a copy of the original instance CBotVar* pInstance = NULL; if ( !CBotVar::RestoreState( pf, pInstance ) ) return false; - ((CBotVarPointer*)pNew)->SetPointer( pInstance ); // and point over + (static_cast(pNew))->SetPointer( pInstance ); // and point over } break; default: -- cgit v1.2.3-1-g7c22