diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2013-06-24 21:37:15 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2013-06-24 21:37:15 +0200 |
commit | 7c2e955e1552a9c4e412ea2c936be61fc78ba010 (patch) | |
tree | ee506dfbec54f998d10c385bde3a1c3fa04e66b2 /src/CBot/CBotClass.cpp | |
parent | e218dcfdf2c58f8841e7ebd220527d08e870a6d5 (diff) | |
parent | b376486fd74fa02b0297ceef6d0f977b32358e5e (diff) | |
download | colobot-7c2e955e1552a9c4e412ea2c936be61fc78ba010.tar.gz colobot-7c2e955e1552a9c4e412ea2c936be61fc78ba010.tar.bz2 colobot-7c2e955e1552a9c4e412ea2c936be61fc78ba010.zip |
Colobot Gold 0.1.0-alpha
Diffstat (limited to 'src/CBot/CBotClass.cpp')
-rw-r--r-- | src/CBot/CBotClass.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/CBot/CBotClass.cpp b/src/CBot/CBotClass.cpp index a1c3fd4..12765ba 100644 --- a/src/CBot/CBotClass.cpp +++ b/src/CBot/CBotClass.cpp @@ -54,7 +54,7 @@ CBotClass::CBotClass(const char* name, CBotClass* pPapa, bool bIntrinsic) CBotClass::~CBotClass() { - // removes the list of class + // removes the list of class if ( m_ExPrev ) m_ExPrev->m_ExNext = m_ExNext; else m_ExClass = m_ExNext; @@ -106,7 +106,7 @@ bool CBotClass::Lock(CBotProgram* p) m_ProgInLock[0] = p; return true; } - if ( p == m_ProgInLock[0] ) + if ( p == m_ProgInLock[0] ) { m_cptOne++; m_cptLock--; // has already been counted @@ -156,14 +156,14 @@ void CBotClass::FreeLock(CBotProgram* p) while ( pClass != NULL ) { - if ( p == pClass->m_ProgInLock[0] ) + if ( p == pClass->m_ProgInLock[0] ) { pClass->m_cptLock -= pClass->m_cptOne; pClass->m_cptOne = 0; } for ( int j = 1; j < 5 ; j++ ) - if ( p == pClass->m_ProgInLock[j] ) + if ( p == pClass->m_ProgInLock[j] ) pClass->m_cptLock--; pClass = pClass->m_ExNext; @@ -291,8 +291,8 @@ CBotClass* CBotClass::Find(const char* name) return NULL; } -bool CBotClass::AddFunction(const char* name, - bool rExec (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception), +bool CBotClass::AddFunction(const char* name, + bool rExec (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception), CBotTypResult rCompile (CBotVar* pThis, CBotVar* &pVar)) { // stores pointers to the two functions @@ -313,7 +313,7 @@ bool CBotClass::AddFunction(const char* name, } p = new CBotCallMethode(name, rExec, rCompile); - + if (m_pCalls == NULL) m_pCalls = p; else m_pCalls->AddNext(p); // added to the list @@ -329,8 +329,8 @@ bool CBotClass::AddUpdateFunc( void rMaj ( CBotVar* pThis, void* pUser ) ) // compiles a method associated with an instance of class // the method can be declared by the user or AddFunction -CBotTypResult CBotClass::CompileMethode(const char* name, - CBotVar* pThis, CBotVar** ppParams, +CBotTypResult CBotClass::CompileMethode(const char* name, + CBotVar* pThis, CBotVar** ppParams, CBotCStack* pStack, long& nIdent) { nIdent = 0; // forget the previous one if necessary @@ -350,8 +350,8 @@ CBotTypResult CBotClass::CompileMethode(const char* name, // executes a method -bool CBotClass::ExecuteMethode(long& nIdent, const char* name, - CBotVar* pThis, CBotVar** ppParams, +bool CBotClass::ExecuteMethode(long& nIdent, const char* name, + CBotVar* pThis, CBotVar** ppParams, CBotVar* &pResult, CBotStack* &pStack, CBotToken* pToken) { @@ -437,7 +437,7 @@ bool CBotClass::RestoreStaticState(FILE* pf) if (!ReadString( pf, VarName )) return false; if ( pClass != NULL ) pVar = pClass->GetItem(VarName); - if (!CBotVar::RestoreState(pf, pv)) return false; // the temp variable + if (!CBotVar::RestoreState(pf, pv)) return false; // the temp variable if ( pVar != NULL ) pVar->Copy(pv); delete pv; @@ -514,7 +514,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* delete inst; // is not type CBotInt p = vartoken; // returns to the variable name - // compiles declaration an array + // compiles declaration an array inst = static_cast<CBotClassInst*>(CBotInstArray::Compile( p, pStk, type )); @@ -595,7 +595,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* goto error; } // if ( !bIntrinsic ) var->SetPointer(pStk->GetVar()->GetPointer()); - if ( !bIntrinsic ) + if ( !bIntrinsic ) { // does not use the result on the stack, to impose the class CBotVar* pvar = CBotVar::Create("", pClass); @@ -608,7 +608,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* { // creates the object on the "job" (\TODO "tas") // with a pointer to the object - if ( !bIntrinsic ) + if ( !bIntrinsic ) { CBotVar* pvar = CBotVar::Create("", pClass); var->SetPointer( pvar ); // variable already declared instance pointer @@ -617,14 +617,14 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* var->SetInit(2); // marks the pointer as init } suite: - if (IsOfType(p, ID_COMMA)) // several chained definitions + if (IsOfType(p, ID_COMMA)) // several chained definitions { if ( NULL != ( inst->m_next = CBotClassInst::Compile(p, pStk, pClass) )) // compiles the following { return pStack->Return(inst, pStk); } } - + if (IsOfType(p, ID_SEP)) // complete instruction { return pStack->Return(inst, pStk); @@ -684,7 +684,7 @@ bool CBotClassInst::Execute(CBotStack* &pj) { // evaluates the expression for the assignment if (!m_expr->Execute(pile)) return false; - + if ( bIntrincic ) { CBotVar* pv = pile->GetVar(); @@ -750,8 +750,8 @@ bool CBotClassInst::Execute(CBotStack* &pj) // creates a variable for the result CBotVar* pResult = NULL; // constructor still void - if ( !pClass->ExecuteMethode(m_nMethodeIdent, pClass->GetName(), - pThis, ppVars, + if ( !pClass->ExecuteMethode(m_nMethodeIdent, pClass->GetName(), + pThis, ppVars, pResult, pile2, GetToken())) return false; // interrupt pThis->SetInit(true); |