diff options
Diffstat (limited to 'src/CBot/CBotProgram.cpp')
-rw-r--r-- | src/CBot/CBotProgram.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/CBot/CBotProgram.cpp b/src/CBot/CBotProgram.cpp index f4987a7..1944f92 100644 --- a/src/CBot/CBotProgram.cpp +++ b/src/CBot/CBotProgram.cpp @@ -97,7 +97,7 @@ bool CBotProgram::Compile( const char* program, CBotStringArray& ListFonctions, { if ( IsOfType(p, ID_SEP) ) continue; // semicolons lurking - if ( p->GetType() == ID_CLASS || + if ( p->GetType() == ID_CLASS || ( p->GetType() == ID_PUBLIC && p->GetNext()->GetType() == ID_CLASS )) { CBotClass* nxt = CBotClass::Compile1(p, pStack); @@ -113,7 +113,7 @@ bool CBotProgram::Compile( const char* program, CBotStringArray& ListFonctions, } if ( !pStack->IsOk() ) { - m_ErrorCode = pStack->GetError(m_ErrorStart, m_ErrorEnd); + m_ErrorCode = pStack->GetError(m_ErrorStart, m_ErrorEnd); delete m_Prog; m_Prog = NULL; delete pBaseToken; @@ -129,7 +129,7 @@ bool CBotProgram::Compile( const char* program, CBotStringArray& ListFonctions, { if ( IsOfType(p, ID_SEP) ) continue; // semicolons lurking - if ( p->GetType() == ID_CLASS || + if ( p->GetType() == ID_CLASS || ( p->GetType() == ID_PUBLIC && p->GetNext()->GetType() == ID_CLASS )) { m_bCompileClass = true; @@ -150,7 +150,7 @@ bool CBotProgram::Compile( const char* program, CBotStringArray& ListFonctions, if ( !pStack->IsOk() ) { - m_ErrorCode = pStack->GetError(m_ErrorStart, m_ErrorEnd); + m_ErrorCode = pStack->GetError(m_ErrorStart, m_ErrorEnd); delete m_Prog; m_Prog = NULL; } @@ -228,7 +228,7 @@ bool CBotProgram::Run(void* pUser, int timer) #if STACKRUN // resumes execution on the top of the stack ok = m_pStack->Execute(); - if ( ok ) + if ( ok ) { #ifdef _DEBUG CBotVar* ppVar[3]; @@ -354,8 +354,8 @@ CBotFunction* CBotProgram::GetFunctions() return m_Prog; } -bool CBotProgram::AddFunction(const char* name, - bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser), +bool CBotProgram::AddFunction(const char* name, + bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser), CBotTypResult rCompile (CBotVar* &pVar, void* pUser)) { // stores pointers to the two functions @@ -369,7 +369,7 @@ bool WriteWord(FILE* pf, unsigned short w) lg = fwrite(&w, sizeof( unsigned short ), 1, pf ); - return (lg == 1); + return (lg == 1); } bool ReadWord(FILE* pf, unsigned short& w) @@ -387,7 +387,7 @@ bool WriteFloat(FILE* pf, float w) lg = fwrite(&w, sizeof( float ), 1, pf ); - return (lg == 1); + return (lg == 1); } bool ReadFloat(FILE* pf, float& w) @@ -405,7 +405,7 @@ bool WriteLong(FILE* pf, long w) lg = fwrite(&w, sizeof( long ), 1, pf ); - return (lg == 1); + return (lg == 1); } bool ReadLong(FILE* pf, long& w) @@ -425,7 +425,7 @@ bool WriteString(FILE* pf, CBotString s) if (!WriteWord(pf, lg1)) return false; lg2 = fwrite(s, 1, lg1, pf ); - return (lg1 == lg2); + return (lg1 == lg2); } bool ReadString(FILE* pf, CBotString& s) @@ -510,7 +510,7 @@ bool CBotProgram::SaveState(FILE* pf) if (!WriteString( pf, m_pRun->GetName() )) return false; if (!m_pStack->SaveState(pf)) return false; } - else + else { if (!WriteWord( pf, 0)) return false; } @@ -560,9 +560,9 @@ int CBotProgram::GetVersion() ////////////////////////////////////////////////////////////////////////////////////////////////////// CBotCall* CBotCall::m_ListCalls = NULL; - -CBotCall::CBotCall(const char* name, - bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser), + +CBotCall::CBotCall(const char* name, + bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser), CBotTypResult rCompile (CBotVar* &pVar, void* pUser)) { m_name = name; @@ -583,8 +583,8 @@ void CBotCall::Free() delete CBotCall::m_ListCalls; } -bool CBotCall::AddFunction(const char* name, - bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser), +bool CBotCall::AddFunction(const char* name, + bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser), CBotTypResult rCompile (CBotVar* &pVar, void* pUser)) { CBotCall* p = m_ListCalls; @@ -608,7 +608,7 @@ bool CBotCall::AddFunction(const char* name, } pp = new CBotCall(name, rExec, rCompile); - + if (p) p->m_next = pp; else m_ListCalls = pp; @@ -658,7 +658,7 @@ CBotTypResult CBotCall::CompileCall(CBotToken* &p, CBotVar** ppVar, CBotCStack* CBotVar* pVar2 = pVar; CBotTypResult r = pt->m_rComp(pVar2, m_pUser); int ret = r.GetType(); - + // if a class is returned, it is actually a pointer if ( ret == CBotTypClass ) r.SetType( ret = CBotTypPointer ); @@ -859,8 +859,8 @@ bool CBotCall::Run(CBotStack* pStack) /////////////////////////////////////////////////////////////////////////////////////// -CBotCallMethode::CBotCallMethode(const char* name, - bool rExec (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception), +CBotCallMethode::CBotCallMethode(const char* name, + bool rExec (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception), CBotTypResult rCompile (CBotVar* pThis, CBotVar* &pVar)) { m_name = name; @@ -879,7 +879,7 @@ CBotCallMethode::~CBotCallMethode() // is acceptable by a call procedure name // and given parameters -CBotTypResult CBotCallMethode::CompileCall(const char* name, CBotVar* pThis, +CBotTypResult CBotCallMethode::CompileCall(const char* name, CBotVar* pThis, CBotVar** ppVar, CBotCStack* pStack, long& nIdent) { @@ -1008,7 +1008,7 @@ bool rSizeOf( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser ) while ( pVar != NULL ) { - i++; + i++; pVar = pVar->GetNext(); } @@ -1107,7 +1107,7 @@ void CBotProgram::Init() void CBotProgram::Free() { - CBotToken::Free() ; + CBotToken::Free() ; CBotCall ::Free() ; CBotClass::Free() ; } |