Fixed code formatting
* moved braces to new lines * fixed some function/variable names * fixed whitespace issuesdev-ui
parent
538745a731
commit
8765d58b02
|
@ -510,7 +510,7 @@ CBotInstr* CBotLeftExprVar::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
return inst;
|
||||
}
|
||||
|
||||
// creates a variable and assigns the result to the stack
|
||||
// creates a variable and assigns the result to the stack
|
||||
bool CBotLeftExprVar::Execute(CBotStack* &pj)
|
||||
{
|
||||
CBotVar* var1;
|
||||
|
@ -1073,7 +1073,7 @@ bool CBotInt::Execute(CBotStack* &pj)
|
|||
|
||||
if (pile->IfStep()) return false;
|
||||
|
||||
if ( m_next2b &&
|
||||
if ( m_next2b &&
|
||||
!m_next2b->Execute(pile)) return false; // other(s) definition(s)
|
||||
|
||||
return pj->Return(pile); // forward below
|
||||
|
@ -1558,8 +1558,8 @@ CBotInstr* CBotExpression::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
int OpType = p->GetType();
|
||||
|
||||
if ( pStack->IsOk() &&
|
||||
IsOfTypeList(p, ID_ASS, ID_ASSADD, ID_ASSSUB, ID_ASSMUL, ID_ASSDIV, ID_ASSMODULO,
|
||||
ID_ASSAND, ID_ASSXOR, ID_ASSOR,
|
||||
IsOfTypeList(p, ID_ASS, ID_ASSADD, ID_ASSSUB, ID_ASSMUL, ID_ASSDIV, ID_ASSMODULO,
|
||||
ID_ASSAND, ID_ASSXOR, ID_ASSOR,
|
||||
ID_ASSSL , ID_ASSSR, ID_ASSASR, 0 ))
|
||||
{
|
||||
if (inst->m_leftop == NULL)
|
||||
|
@ -1655,7 +1655,7 @@ bool CBotExpression::Execute(CBotStack* &pj)
|
|||
CBotStack* pile = pj->AddStack(this);
|
||||
|
||||
// CBotToken* pToken = m_leftop->GetToken();
|
||||
|
||||
|
||||
CBotVar* pVar = NULL;
|
||||
|
||||
CBotStack* pile1 = pile;
|
||||
|
@ -1711,13 +1711,13 @@ bool CBotExpression::Execute(CBotStack* &pj)
|
|||
pile2->SetVar(result);
|
||||
break;
|
||||
case ID_ASSDIV:
|
||||
if (IsInit &&
|
||||
if (IsInit &&
|
||||
result->Div(pile1->GetVar(), pile2->GetVar()))
|
||||
pile2->SetError(TX_DIVZERO, &m_token);
|
||||
pile2->SetVar(result);
|
||||
break;
|
||||
case ID_ASSMODULO:
|
||||
if (IsInit &&
|
||||
if (IsInit &&
|
||||
result->Modulo(pile1->GetVar(), pile2->GetVar()))
|
||||
pile2->SetError(TX_DIVZERO, &m_token);
|
||||
pile2->SetVar(result);
|
||||
|
@ -1776,7 +1776,7 @@ void CBotExpression::RestoreState(CBotStack* &pj, bool bMain)
|
|||
|
||||
if ( pile1->GetState()==0)
|
||||
{
|
||||
m_leftop->RestoreStateVar(pile, true);
|
||||
m_leftop->RestoreStateVar(pile, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1969,7 +1969,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
}
|
||||
|
||||
// is it a number or DefineNum?
|
||||
if (p->GetType() == TokenTypNum ||
|
||||
if (p->GetType() == TokenTypNum ||
|
||||
p->GetType() == TokenTypDef )
|
||||
{
|
||||
CBotInstr* inst = CBotExprNum::Compile(p, pStk);
|
||||
|
@ -2066,7 +2066,7 @@ bool CBotPostIncExpr::Execute(CBotStack* &pj)
|
|||
pile1->SetState(1);
|
||||
pile1->SetCopyVar(var1); // places the result (before incrementation);
|
||||
|
||||
CBotStack* pile3 = pile2->AddStack(this);
|
||||
CBotStack* pile3 = pile2->AddStack(this);
|
||||
if (pile3->IfStep()) return false;
|
||||
|
||||
if (var1->GetInit() == IS_NAN)
|
||||
|
@ -2321,7 +2321,7 @@ bool CBotIndexExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
|
|||
|
||||
pVar->Maj(pile->GetPUser(), true);
|
||||
|
||||
if ( m_next3 != NULL &&
|
||||
if ( m_next3 != NULL &&
|
||||
!m_next3->ExecuteVar(pVar, pile, prevToken, bStep, bExtend) ) return false;
|
||||
|
||||
// does not release the stack
|
||||
|
@ -2340,7 +2340,7 @@ void CBotIndexExpr::RestoreStateVar(CBotStack* &pile, bool bMain)
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_next3)
|
||||
if (m_next3)
|
||||
m_next3->RestoreStateVar(pile, bMain);
|
||||
}
|
||||
|
||||
|
@ -2428,7 +2428,7 @@ bool CBotFieldExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prev
|
|||
// request the update of the element, if applicable
|
||||
pVar->Maj(pile->GetPUser(), true);
|
||||
|
||||
if ( m_next3 != NULL &&
|
||||
if ( m_next3 != NULL &&
|
||||
!m_next3->ExecuteVar(pVar, pile, &m_token, bStep, bExtend) ) return false;
|
||||
|
||||
// does not release the stack
|
||||
|
@ -2442,7 +2442,7 @@ void CBotFieldExpr::RestoreStateVar(CBotStack* &pj, bool bMain)
|
|||
pj = pj->RestoreStack(this);
|
||||
if (pj == NULL) return;
|
||||
|
||||
if (m_next3 != NULL)
|
||||
if (m_next3 != NULL)
|
||||
m_next3->RestoreStateVar(pj, bMain);
|
||||
}
|
||||
|
||||
|
@ -2656,7 +2656,7 @@ bool CBotLeftExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevT
|
|||
|
||||
if (bStep && m_next3 == NULL && pile->IfStep()) return false;
|
||||
|
||||
if ( m_next3 != NULL &&
|
||||
if ( m_next3 != NULL &&
|
||||
!m_next3->ExecuteVar(pVar, pile, &m_token, bStep, true) ) return false;
|
||||
|
||||
return true;
|
||||
|
@ -2667,7 +2667,7 @@ void CBotLeftExpr::RestoreStateVar(CBotStack* &pile, bool bMain)
|
|||
pile = pile->RestoreStack(this);
|
||||
if (pile == NULL) return;
|
||||
|
||||
if (m_next3 != NULL)
|
||||
if (m_next3 != NULL)
|
||||
m_next3->RestoreStateVar(pile, bMain);
|
||||
}
|
||||
|
||||
|
@ -3095,7 +3095,7 @@ CBotInstr* CBotExprVar::Compile(CBotToken* &p, CBotCStack* pStack, int privat)
|
|||
{
|
||||
if (var->GetType() == CBotTypArrayPointer)
|
||||
{
|
||||
if (IsOfType( p, ID_OPBRK )) // check if there is an aindex
|
||||
if (IsOfType( p, ID_OPBRK )) // check if there is an aindex
|
||||
{
|
||||
CBotIndexExpr* i = new CBotIndexExpr();
|
||||
i->m_expr = CBotExpression::Compile(p, pStk); // compile the formula
|
||||
|
@ -3412,7 +3412,7 @@ CBotInstr* CBotInstrMethode::Compile(CBotToken* &p, CBotCStack* pStack, CBotVar*
|
|||
{
|
||||
CBotClass* pClass = var->GetClass(); // pointer to the class
|
||||
inst->m_ClassName = pClass->GetName(); // name of the class
|
||||
CBotTypResult r = pClass->CompileMethode(inst->m_NomMethod, var, ppVars,
|
||||
CBotTypResult r = pClass->CompileMethode(inst->m_NomMethod, var, ppVars,
|
||||
pStack, inst->m_MethodeIdent);
|
||||
delete pStack->TokenStack(); // release parameters on the stack
|
||||
inst->m_typRes = r;
|
||||
|
@ -3504,8 +3504,8 @@ bool CBotInstrMethode::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* pre
|
|||
}
|
||||
CBotVar* pRes = pResult;
|
||||
|
||||
if ( !pClass->ExecuteMethode(m_MethodeIdent, m_NomMethod,
|
||||
pThis, ppVars,
|
||||
if ( !pClass->ExecuteMethode(m_MethodeIdent, m_NomMethod,
|
||||
pThis, ppVars,
|
||||
pResult, pile2, GetToken())) return false;
|
||||
if (pRes != pResult) delete pRes;
|
||||
|
||||
|
@ -3555,7 +3555,7 @@ void CBotInstrMethode::RestoreStateVar(CBotStack* &pile, bool bMain)
|
|||
|
||||
// CBotVar* pRes = pResult;
|
||||
|
||||
pClass->RestoreMethode(m_MethodeIdent, m_NomMethod,
|
||||
pClass->RestoreMethode(m_MethodeIdent, m_NomMethod,
|
||||
pThis, ppVars, pile2);
|
||||
}
|
||||
|
||||
|
@ -3609,8 +3609,8 @@ bool CBotInstrMethode::Execute(CBotStack* &pj)
|
|||
}
|
||||
CBotVar* pRes = pResult;
|
||||
|
||||
if ( !pClass->ExecuteMethode(m_MethodeIdent, m_NomMethod,
|
||||
pThis, ppVars,
|
||||
if ( !pClass->ExecuteMethode(m_MethodeIdent, m_NomMethod,
|
||||
pThis, ppVars,
|
||||
pResult, pile2, GetToken())) return false; // interupted
|
||||
|
||||
// set the new value of this in place of the old variable
|
||||
|
@ -3625,7 +3625,7 @@ bool CBotInstrMethode::Execute(CBotStack* &pj)
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// compile an instruction "new"
|
||||
// compile an instruction "new"
|
||||
|
||||
CBotNew::CBotNew()
|
||||
{
|
||||
|
@ -3770,8 +3770,8 @@ bool CBotNew::Execute(CBotStack* &pj)
|
|||
// create a variable for the result
|
||||
CBotVar* pResult = NULL; // constructos 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->ConstructorSet(); // indicates that the constructor has been called
|
||||
|
@ -3857,13 +3857,13 @@ bool TypeCompatible(CBotTypResult& type1, CBotTypResult& type2, int op)
|
|||
|
||||
if (max >= CBotTypBoolean)
|
||||
{
|
||||
if ( (op == ID_EQ || op == ID_NE) &&
|
||||
if ( (op == ID_EQ || op == ID_NE) &&
|
||||
(t1 == CBotTypPointer && t2 == CBotTypNullPointer)) return true;
|
||||
if ( (op == ID_EQ || op == ID_NE || op == ID_ASS) &&
|
||||
if ( (op == ID_EQ || op == ID_NE || op == ID_ASS) &&
|
||||
(t2 == CBotTypPointer && t1 == CBotTypNullPointer)) return true;
|
||||
if ( (op == ID_EQ || op == ID_NE) &&
|
||||
if ( (op == ID_EQ || op == ID_NE) &&
|
||||
(t1 == CBotTypArrayPointer && t2 == CBotTypNullPointer)) return true;
|
||||
if ( (op == ID_EQ || op == ID_NE || op == ID_ASS) &&
|
||||
if ( (op == ID_EQ || op == ID_NE || op == ID_ASS) &&
|
||||
(t2 == CBotTypArrayPointer && t1 == CBotTypNullPointer)) return true;
|
||||
if (t2 != t1) return false;
|
||||
if (t1 == CBotTypArrayPointer) return type1.Compare(type2);
|
||||
|
|
|
@ -69,7 +69,7 @@ class CBotDefParam; // paramerer list of a function
|
|||
// to use for routine CBotProgram :: Execute (CBotStack)
|
||||
|
||||
|
||||
/**\class CBotStack
|
||||
/**\class CBotStack
|
||||
* \brief Management of the execution stack.
|
||||
* \brief Actually the only thing it can do is to create an instance of a stack
|
||||
* \brief to use for routine CBotProgram :: Execute(CBotStack)*/
|
||||
|
@ -210,14 +210,14 @@ public:
|
|||
// in case of eventual break
|
||||
bool IfContinue(int state, const char* name);
|
||||
// or "continue"
|
||||
|
||||
|
||||
bool IsOk();
|
||||
|
||||
bool SetState(int n, int lim = -10); // select a state
|
||||
int GetState(); // in what state am I?
|
||||
bool IncState(int lim = -10); // passes to the next state
|
||||
bool IfStep(); // do step by step
|
||||
bool Execute();
|
||||
bool Execute();
|
||||
|
||||
void SetVar( CBotVar* var );
|
||||
void SetCopyVar( CBotVar* var );
|
||||
|
@ -259,7 +259,7 @@ private:
|
|||
CBotStack* m_prev;
|
||||
friend class CBotInstArray;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef _DEBUG
|
||||
int m_index;
|
||||
#endif
|
||||
int m_state;
|
||||
|
@ -360,7 +360,7 @@ public:
|
|||
CBotCStack* TokenStack(CBotToken* pToken = NULL, bool bBlock = false);
|
||||
CBotInstr* Return(CBotInstr* p, CBotCStack* pParent); // transmits the result upper
|
||||
CBotFunction* ReturnFunc(CBotFunction* p, CBotCStack* pParent); // transmits the result upper
|
||||
|
||||
|
||||
void SetVar( CBotVar* var );
|
||||
void SetCopyVar( CBotVar* var );
|
||||
CBotVar* GetVar();
|
||||
|
@ -480,7 +480,7 @@ class CBotWhile : public CBotInstr
|
|||
private:
|
||||
CBotInstr* m_Condition; // condition
|
||||
CBotInstr* m_Block; // instructions
|
||||
CBotString m_label; // a label if there is
|
||||
CBotString m_label; // a label if there is
|
||||
|
||||
public:
|
||||
CBotWhile();
|
||||
|
@ -496,7 +496,7 @@ class CBotDo : public CBotInstr
|
|||
private:
|
||||
CBotInstr* m_Block; // instruction
|
||||
CBotInstr* m_Condition; // conditions
|
||||
CBotString m_label; // a label if there is
|
||||
CBotString m_label; // a label if there is
|
||||
|
||||
public:
|
||||
CBotDo();
|
||||
|
@ -514,7 +514,7 @@ private:
|
|||
CBotInstr* m_Test; // test condition
|
||||
CBotInstr* m_Incr; // instruction for increment
|
||||
CBotInstr* m_Block; // instructions
|
||||
CBotString m_label; // a label if there is
|
||||
CBotString m_label; // a label if there is
|
||||
|
||||
public:
|
||||
CBotFor();
|
||||
|
@ -528,7 +528,7 @@ public:
|
|||
class CBotBreak : public CBotInstr
|
||||
{
|
||||
private:
|
||||
CBotString m_label; // a label if there is
|
||||
CBotString m_label; // a label if there is
|
||||
|
||||
public:
|
||||
CBotBreak();
|
||||
|
@ -542,7 +542,7 @@ public:
|
|||
class CBotReturn : public CBotInstr
|
||||
{
|
||||
private:
|
||||
CBotInstr* m_Instr; // paramter of return
|
||||
CBotInstr* m_Instr; // paramter of return
|
||||
|
||||
public:
|
||||
CBotReturn();
|
||||
|
@ -557,7 +557,7 @@ public:
|
|||
class CBotSwitch : public CBotInstr
|
||||
{
|
||||
private:
|
||||
CBotInstr* m_Value; // value to seek
|
||||
CBotInstr* m_Value; // value to seek
|
||||
CBotInstr* m_Block; // instructions
|
||||
|
||||
public:
|
||||
|
@ -704,7 +704,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
// definition of a assignment list for a table
|
||||
// definition of a assignment list for a table
|
||||
// int [ ] a [ ] = ( ( 1, 2, 3 ) , ( 3, 2, 1 ) ) ;
|
||||
|
||||
class CBotListArray : public CBotInstr
|
||||
|
@ -1415,12 +1415,12 @@ public:
|
|||
void IncrementUse(); // a reference to incrementation
|
||||
void DecrementUse(); // a reference to decrementation
|
||||
|
||||
CBotVarClass*
|
||||
CBotVarClass*
|
||||
GetPointer();
|
||||
void SetItemList(CBotVar* pVar);
|
||||
|
||||
void SetIdent(long n);
|
||||
|
||||
|
||||
static CBotVarClass* Find(long id);
|
||||
|
||||
|
||||
|
@ -1489,7 +1489,7 @@ public:
|
|||
void SetPointer(CBotVar* p);
|
||||
CBotVarClass*
|
||||
GetPointer();
|
||||
|
||||
|
||||
void Copy(CBotVar* pSrc, bool bName=true);
|
||||
CBotVar* GetItem(int n, bool bGrow=false); // makes an element according to its numeric index
|
||||
// enlarged the table if necessary if bExtend
|
||||
|
@ -1544,14 +1544,14 @@ private:
|
|||
CBotCall* m_next;
|
||||
|
||||
public:
|
||||
CBotCall(const char* name,
|
||||
bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser),
|
||||
CBotCall(const char* name,
|
||||
bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser),
|
||||
CBotTypResult rCompile (CBotVar* &pVar, void* pUser));
|
||||
~CBotCall();
|
||||
|
||||
static
|
||||
bool AddFunction(const char* name,
|
||||
bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser),
|
||||
bool AddFunction(const char* name,
|
||||
bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser),
|
||||
CBotTypResult rCompile (CBotVar* &pVar, void* pUser));
|
||||
|
||||
static
|
||||
|
@ -1572,7 +1572,7 @@ public:
|
|||
|
||||
CBotString GetName();
|
||||
CBotCall* Next();
|
||||
|
||||
|
||||
static void SetPUser(void* pUser);
|
||||
static void Free();
|
||||
};
|
||||
|
@ -1591,13 +1591,13 @@ private:
|
|||
long m_nFuncIdent;
|
||||
|
||||
public:
|
||||
CBotCallMethode(const char* name,
|
||||
bool rExec (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception),
|
||||
CBotCallMethode(const char* name,
|
||||
bool rExec (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception),
|
||||
CBotTypResult rCompile (CBotVar* pThis, CBotVar* &pVar));
|
||||
~CBotCallMethode();
|
||||
|
||||
CBotTypResult
|
||||
CompileCall(const char* name, CBotVar* pThis,
|
||||
CompileCall(const char* name, CBotVar* pThis,
|
||||
CBotVar** ppVars, CBotCStack* pStack,
|
||||
long& nIdent);
|
||||
|
||||
|
@ -1606,7 +1606,7 @@ public:
|
|||
CBotString GetName();
|
||||
CBotCallMethode* Next();
|
||||
void AddNext(CBotCallMethode* p);
|
||||
|
||||
|
||||
};
|
||||
|
||||
// a list of parameters
|
||||
|
@ -1703,4 +1703,3 @@ public:
|
|||
bool GetPosition(int& start, int& stop, CBotGet modestart, CBotGet modestop);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ CBotInstr* CBotAddExpr::Compile(CBotToken* &p, CBotStack* pStack)
|
|||
return pStack->Return(NULL, pStk);
|
||||
}
|
||||
|
||||
// if we are not dealing with an operation + or -
|
||||
// if we are not dealing with an operation + or -
|
||||
// goes to that requested, the operand (left) found
|
||||
// place the object "addition"
|
||||
return pStack->Return(left, pStk);
|
||||
|
@ -141,4 +141,3 @@ bool CBotAddExpr::Execute(CBotStack* &pStack)
|
|||
return pStack->Return(pStk1); // transmits the result
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -83,7 +83,7 @@ CBotInstr* CBotCompExpr::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
}
|
||||
|
||||
|
||||
// perform the operation
|
||||
// perform the operation
|
||||
|
||||
bool CBotCompExpr::Execute(CBotStack* &pStack)
|
||||
{
|
||||
|
|
|
@ -93,22 +93,22 @@ public:
|
|||
CBotTypResult(int type);
|
||||
// for simple types (CBotTypInt à CBotTypString)
|
||||
|
||||
|
||||
|
||||
CBotTypResult(int type, const char* name);
|
||||
// for pointer types and intrinsic classes
|
||||
|
||||
|
||||
CBotTypResult(int type, CBotClass* pClass);
|
||||
// for the instance of a class
|
||||
|
||||
|
||||
CBotTypResult(int type, CBotTypResult elem);
|
||||
// for arrays of variables
|
||||
|
||||
|
||||
CBotTypResult(const CBotTypResult& typ);
|
||||
// for assignments
|
||||
|
||||
|
||||
CBotTypResult();
|
||||
// for default
|
||||
|
||||
|
||||
~CBotTypResult();
|
||||
|
||||
int GetType(int mode = 0) const;
|
||||
|
@ -147,7 +147,7 @@ private:
|
|||
CBotClass* m_pClass; // for the derivatives of class
|
||||
int m_limite; // limits of tables
|
||||
friend class CBotVarClass;
|
||||
friend class CBotVarPointer;
|
||||
friend class CBotVarPointer;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -246,7 +246,7 @@ private:
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// as part of MFC CString not used here.
|
||||
//
|
||||
// ( all functions are not implemented yet )
|
||||
|
@ -451,12 +451,12 @@ public:
|
|||
|
||||
static
|
||||
void SetTimer(int n);
|
||||
// defines the number of steps (parts of instructions) to done
|
||||
// defines the number of steps (parts of instructions) to done
|
||||
// in Run() before rendering hand "false" \TODO avant de rendre la main "false"
|
||||
|
||||
static
|
||||
bool AddFunction(const char* name,
|
||||
bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser),
|
||||
bool AddFunction(const char* name,
|
||||
bool rExec (CBotVar* pVar, CBotVar* pResult, int& Exception, void* pUser),
|
||||
CBotTypResult rCompile (CBotVar* &pVar, void* pUser));
|
||||
// call this to add externally (**)
|
||||
// a new function used by the program CBoT
|
||||
|
@ -472,8 +472,8 @@ public:
|
|||
// restores the state of execution from file
|
||||
// the compiled program must obviously be the same
|
||||
|
||||
bool GetPosition(const char* name, int& start, int& stop,
|
||||
CBotGet modestart = GetPosExtern,
|
||||
bool GetPosition(const char* name, int& start, int& stop,
|
||||
CBotGet modestart = GetPosExtern,
|
||||
CBotGet modestop = GetPosBloc);
|
||||
// gives the position of a routine in the original text
|
||||
// the user can select the item to find from the beginning to the end
|
||||
|
@ -513,7 +513,7 @@ int cMean(CBotVar* &pVar, CBotString& ClassName)
|
|||
|
||||
while ( pVar != NULL )
|
||||
{
|
||||
if ( pVar->GetType() > CBotTypDouble ) return 6002; // this is not a number
|
||||
if ( pVar->GetType() > CBotTypDouble ) return 6002; // this is not a number
|
||||
pVar = pVar -> GetNext();
|
||||
}
|
||||
|
||||
|
@ -623,7 +623,7 @@ virtual ~CBotVar( ); // destructor
|
|||
void SetName(const char* name); // changes the name of the variable
|
||||
|
||||
int GetType(int mode = 0); // returns the base type (int) of the variable
|
||||
// TODO check it
|
||||
// TODO check it
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CBotTypResult GetTypResult(int mode = 0); // returns the complete type of the variable
|
||||
|
@ -654,7 +654,7 @@ virtual ~CBotVar( ); // destructor
|
|||
CBotVar* GetItemRef(int nIdent); // idem à partir du n° ref
|
||||
// TODO ditto from ref no.
|
||||
virtual
|
||||
CBotVar* GetItem(int row, bool bGrow = false);
|
||||
CBotVar* GetItem(int row, bool bGrow = false);
|
||||
|
||||
virtual
|
||||
CBotVar* GetItemList(); // lists the elements
|
||||
|
@ -802,8 +802,8 @@ public:
|
|||
|
||||
~CBotClass( ); // destructor
|
||||
|
||||
bool AddFunction(const char* name,
|
||||
bool rExec (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception),
|
||||
bool AddFunction(const char* name,
|
||||
bool rExec (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception),
|
||||
CBotTypResult rCompile (CBotVar* pThis, CBotVar* &pVar));
|
||||
// this call allows to add as external (**)
|
||||
// new method used by the objects of this class
|
||||
|
@ -841,7 +841,7 @@ public:
|
|||
CBotVar* GetItem(const char* name); // one of the variables according to its name
|
||||
CBotVar* GetItemRef(int nIdent);
|
||||
|
||||
CBotTypResult CompileMethode(const char* name, CBotVar* pThis, CBotVar** ppParams,
|
||||
CBotTypResult CompileMethode(const char* name, CBotVar* pThis, CBotVar** ppParams,
|
||||
CBotCStack* pStack, long& nIdent);
|
||||
|
||||
bool ExecuteMethode(long& nIdent, const char* name, CBotVar* pThis, CBotVar** ppParams, CBotVar* &pResult, CBotStack* &pStack, CBotToken* pToken);
|
||||
|
@ -854,7 +854,7 @@ public:
|
|||
CBotClass* Compile1(CBotToken* &p, CBotCStack* pStack);
|
||||
|
||||
bool CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond);
|
||||
|
||||
|
||||
bool IsIntrinsic();
|
||||
void Purge();
|
||||
static
|
||||
|
@ -917,7 +917,7 @@ private:
|
|||
|
||||
int m_start; // position in the original text (program)
|
||||
int m_end; // the same for the end of the token
|
||||
|
||||
|
||||
/**
|
||||
* \brief Check whether given parameter is a keyword
|
||||
*/
|
||||
|
@ -979,11 +979,11 @@ public:
|
|||
CBotToken* GetPrev();
|
||||
|
||||
/**
|
||||
* \brief transforms the entire program
|
||||
* \brief transforms the entire program
|
||||
*/
|
||||
static
|
||||
CBotToken* CompileTokens(const char* p, int& error);
|
||||
|
||||
|
||||
/**
|
||||
* \brief releases the list
|
||||
*/
|
||||
|
|
|
@ -28,7 +28,7 @@ CBotFunction::CBotFunction()
|
|||
m_Param = NULL; // empty parameter list
|
||||
m_Block = NULL; // the instruction block
|
||||
m_next = NULL; // functions can be chained
|
||||
m_bPublic = false; // function not public
|
||||
m_bPublic = false; // function not public
|
||||
m_bExtern = false; // function not extern
|
||||
m_nextpublic = NULL;
|
||||
m_prevpublic = NULL;
|
||||
|
@ -159,9 +159,9 @@ CBotTypResult TypeParam(CBotToken* &p, CBotCStack* pile)
|
|||
if ( pClass != NULL)
|
||||
{
|
||||
p = p->GetNext();
|
||||
return ArrayType(p, pile,
|
||||
pClass->IsIntrinsic() ?
|
||||
CBotTypResult( CBotTypIntrinsic, pClass ) :
|
||||
return ArrayType(p, pile,
|
||||
pClass->IsIntrinsic() ?
|
||||
CBotTypResult( CBotTypIntrinsic, pClass ) :
|
||||
CBotTypResult( CBotTypPointer, pClass ) );
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
|
|||
}
|
||||
}
|
||||
|
||||
// and compiles the following instruction block
|
||||
// and compiles the following instruction block
|
||||
func->m_openblk = p;
|
||||
func->m_Block = CBotBlock::Compile(p, pStk, false);
|
||||
func->m_closeblk = p->GetPrev();
|
||||
|
@ -288,7 +288,7 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas
|
|||
{
|
||||
CBotFunction* func = new CBotFunction();
|
||||
func->m_nFuncIdent = CBotVar::NextUniqNum();
|
||||
|
||||
|
||||
CBotCStack* pStk = pStack->TokenStack(p, true);
|
||||
|
||||
while (true)
|
||||
|
@ -334,7 +334,7 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas
|
|||
func->m_Param = CBotDefParam::Compile( p, pStk );
|
||||
if (pStk->IsOk())
|
||||
{
|
||||
// looks if the function exists elsewhere
|
||||
// looks if the function exists elsewhere
|
||||
if (( pClass != NULL || !pStack->CheckCall(pp, func->m_Param)) &&
|
||||
( pClass == NULL || !pClass->CheckCall(pp, func->m_Param)) )
|
||||
{
|
||||
|
@ -350,7 +350,7 @@ CBotFunction* CBotFunction::Compile1(CBotToken* &p, CBotCStack* pStack, CBotClas
|
|||
if (type == ID_CLBLK) level--;
|
||||
}
|
||||
while (level > 0 && p != NULL);
|
||||
|
||||
|
||||
return pStack->ReturnFunc(func, pStk);
|
||||
}
|
||||
pStk->SetError(TX_OPENBLK, p);
|
||||
|
@ -528,7 +528,7 @@ CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const char* name, CB
|
|||
pv = pv->GetNext();
|
||||
pw = ppVars[i++];
|
||||
}
|
||||
if ( pw != NULL )
|
||||
if ( pw != NULL )
|
||||
{
|
||||
if ( pFunc != NULL ) continue;
|
||||
if ( TypeOrError.Eq(TX_LOWPARAM) ) TypeOrError.SetType(TX_NUMPARAM);
|
||||
|
@ -583,7 +583,7 @@ CBotFunction* CBotFunction::FindLocalOrPublic(long& nIdent, const char* name, CB
|
|||
pv = pv->GetNext();
|
||||
pw = ppVars[i++];
|
||||
}
|
||||
if ( pw != NULL )
|
||||
if ( pw != NULL )
|
||||
{
|
||||
if ( pFunc != NULL ) continue;
|
||||
if ( TypeOrError.Eq(TX_LOWPARAM) ) TypeOrError.SetType(TX_NUMPARAM);
|
||||
|
@ -630,7 +630,7 @@ int CBotFunction::DoCall(long& nIdent, const char* name, CBotVar** ppVars, CBotS
|
|||
{
|
||||
CBotTypResult type;
|
||||
CBotFunction* pt = NULL;
|
||||
|
||||
|
||||
pt = FindLocalOrPublic(nIdent, name, ppVars, type);
|
||||
|
||||
if ( pt != NULL )
|
||||
|
@ -754,7 +754,7 @@ void CBotFunction::RestoreCall(long& nIdent, const char* name, CBotVar** ppVars,
|
|||
|
||||
|
||||
|
||||
// makes call of a method
|
||||
// makes call of a method
|
||||
// note: this is already on the stack, the pointer pThis is just to simplify
|
||||
|
||||
int CBotFunction::DoCall(long& nIdent, const char* name, CBotVar* pThis, CBotVar** ppVars, CBotStack* pStack, CBotToken* pToken, CBotClass* pClass)
|
||||
|
@ -951,7 +951,7 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
if (IsOfType(p, ID_OPENPAR))
|
||||
{
|
||||
CBotDefParam* list = NULL;
|
||||
|
||||
|
||||
while (!IsOfType(p, ID_CLOSEPAR))
|
||||
{
|
||||
CBotDefParam* param = new CBotDefParam();
|
||||
|
@ -1090,7 +1090,7 @@ CBotDefParam* CBotDefParam::GetNext()
|
|||
CBotString CBotDefParam::GetParamString()
|
||||
{
|
||||
CBotString param;
|
||||
|
||||
|
||||
param = m_typename;
|
||||
param += ' ';
|
||||
|
||||
|
@ -1136,7 +1136,7 @@ CBotInstr* CBotReturn::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
if ( pStack->IsOk() )
|
||||
{
|
||||
CBotTypResult retType = pStack->GetTypResult(2);
|
||||
if (TypeCompatible(retType, type, ID_ASS))
|
||||
if (TypeCompatible(retType, type, ID_ASS))
|
||||
{
|
||||
if ( IsOfType( p, ID_SEP ) )
|
||||
return inst;
|
||||
|
@ -1202,7 +1202,7 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
|
||||
int i = 0;
|
||||
|
||||
CBotToken* pp = p;
|
||||
CBotToken* pp = p;
|
||||
p = p->GetNext();
|
||||
|
||||
pStack->SetStartError(p->GetStart());
|
||||
|
@ -1367,7 +1367,7 @@ CBotClass* CBotClass::Compile1(CBotToken* &p, CBotCStack* pStack)
|
|||
pStack->SetError(TX_NOPUBLIC, p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if ( !IsOfType(p, ID_CLASS) ) return NULL;
|
||||
|
||||
CBotString name = p->GetString();
|
||||
|
@ -1443,7 +1443,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
|
|||
return false;
|
||||
}
|
||||
|
||||
while (pStack->IsOk())
|
||||
while (pStack->IsOk())
|
||||
{
|
||||
CBotToken* pp = p;
|
||||
IsOfType(p, ID_NOT); // skips ~ eventual (destructor)
|
||||
|
@ -1484,7 +1484,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
|
|||
if ( !bSecond )
|
||||
{
|
||||
p = pBase;
|
||||
CBotFunction* f =
|
||||
CBotFunction* f =
|
||||
CBotFunction::Compile1(p, pStack, this);
|
||||
|
||||
if ( f == NULL ) return false;
|
||||
|
@ -1497,7 +1497,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
|
|||
// return a method precompiled in pass 1
|
||||
CBotFunction* pf = m_pMethod;
|
||||
CBotFunction* prev = NULL;
|
||||
while ( pf != NULL )
|
||||
while ( pf != NULL )
|
||||
{
|
||||
if (pf->GetName() == pp->GetString()) break;
|
||||
prev = pf;
|
||||
|
@ -1541,7 +1541,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
|
|||
|
||||
// compiles a method
|
||||
p = pBase;
|
||||
CBotFunction* f =
|
||||
CBotFunction* f =
|
||||
CBotFunction::Compile(p, pile, NULL/*, false*/);
|
||||
|
||||
if ( f != NULL )
|
||||
|
@ -1646,3 +1646,4 @@ CBotClass* CBotClass::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
pStack->SetError(TX_ENDOF, p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ bool CBotIf :: Execute(CBotStack* &pj)
|
|||
// passes into the second state
|
||||
if (!pile->SetState(1)) return false; // ready for further
|
||||
}
|
||||
|
||||
|
||||
// second state, evaluates the associated instructions
|
||||
// the result of the condition is on the stack
|
||||
|
||||
|
@ -143,7 +143,7 @@ void CBotIf :: RestoreState(CBotStack* &pj, bool bMain)
|
|||
m_Condition->RestoreState(pile, bMain); // interrupted here!
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// second state, evaluates the associated instructions
|
||||
// the result of the condition is on the stack
|
||||
|
||||
|
|
|
@ -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() ;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ CBotStack* CBotStack::FirstStack()
|
|||
pp->m_bOver = true;
|
||||
pp ++;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
#ifdef _DEBUG
|
||||
int n = 1;
|
||||
pp = p;
|
||||
for ( i = 0 ; i< MAXSTACK+10 ; i++ )
|
||||
|
@ -120,7 +120,7 @@ void CBotStack::Delete()
|
|||
m_index = n;
|
||||
#endif
|
||||
|
||||
if ( p == NULL )
|
||||
if ( p == NULL )
|
||||
free( this );
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ void CBotStack::Delete()
|
|||
// routine improved
|
||||
CBotStack* CBotStack::AddStack(CBotInstr* instr, bool bBlock)
|
||||
{
|
||||
if (m_next != NULL)
|
||||
if (m_next != NULL)
|
||||
{
|
||||
return m_next; // included in an existing stack
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ CBotStack* CBotStack::AddStack(CBotInstr* instr, bool bBlock)
|
|||
|
||||
CBotStack* CBotStack::AddStackEOX(CBotCall* instr, bool bBlock)
|
||||
{
|
||||
if (m_next != NULL)
|
||||
if (m_next != NULL)
|
||||
{
|
||||
if ( m_next == EOX )
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ CBotStack* CBotStack::AddStackEOX(CBotCall* instr, bool bBlock)
|
|||
|
||||
CBotStack* CBotStack::AddStack2(bool bBlock)
|
||||
{
|
||||
if (m_next2 != NULL)
|
||||
if (m_next2 != NULL)
|
||||
{
|
||||
m_next2->m_prog = m_prog; // special avoids RestoreStack2
|
||||
return m_next2; // included in an existing stack
|
||||
|
@ -251,8 +251,8 @@ CBotStack::CBotStack(CBotStack* ppapa)
|
|||
if (ppapa == NULL) m_timer = m_initimer; // sets the timer at the beginning
|
||||
|
||||
m_listVar = NULL;
|
||||
m_bDontDelete = false;
|
||||
|
||||
m_bDontDelete = false;
|
||||
|
||||
m_var = NULL;
|
||||
m_prog = NULL;
|
||||
m_instr = NULL;
|
||||
|
@ -275,7 +275,7 @@ CBotStack::~CBotStack()
|
|||
// \TODO routine has/to optimize
|
||||
CBotStack* CBotStack::AddStack(CBotInstr* instr, bool bBlock)
|
||||
{
|
||||
if (m_next != NULL)
|
||||
if (m_next != NULL)
|
||||
{
|
||||
return m_next; // included in an existing stack
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ CBotStack* CBotStack::AddStack(CBotInstr* instr, bool bBlock)
|
|||
|
||||
CBotStack* CBotStack::AddStackEOX(CBotCall* instr, bool bBlock)
|
||||
{
|
||||
if (m_next != NULL)
|
||||
if (m_next != NULL)
|
||||
{
|
||||
if ( m_next == EOX )
|
||||
{
|
||||
|
@ -311,7 +311,7 @@ CBotStack* CBotStack::AddStackEOX(CBotCall* instr, bool bBlock)
|
|||
|
||||
CBotStack* CBotStack::AddStack2(bool bBlock)
|
||||
{
|
||||
if (m_next2 != NULL)
|
||||
if (m_next2 != NULL)
|
||||
{
|
||||
m_next2->m_prog = m_prog; // special avoids RestoreStack2
|
||||
return m_next2; // included in an existing stack
|
||||
|
@ -362,7 +362,7 @@ void CBotStack::Reset(void* pUser)
|
|||
|
||||
CBotStack* CBotStack::RestoreStack(CBotInstr* instr)
|
||||
{
|
||||
if (m_next != NULL)
|
||||
if (m_next != NULL)
|
||||
{
|
||||
m_next->m_instr = instr; // reset (if recovery after )
|
||||
m_next->m_prog = m_prog;
|
||||
|
@ -480,7 +480,7 @@ CBotVar* CBotStack::FindVar(CBotToken* &pToken, bool bUpdate, bool bModif)
|
|||
{
|
||||
if (pp->GetName() == name)
|
||||
{
|
||||
if ( bUpdate )
|
||||
if ( bUpdate )
|
||||
pp->Maj(m_pUser, false);
|
||||
|
||||
return pp;
|
||||
|
@ -521,7 +521,7 @@ CBotVar* CBotStack::FindVar(long ident, bool bUpdate, bool bModif)
|
|||
{
|
||||
if (pp->GetUniqNum() == ident)
|
||||
{
|
||||
if ( bUpdate )
|
||||
if ( bUpdate )
|
||||
pp->Maj(m_pUser, false);
|
||||
|
||||
return pp;
|
||||
|
@ -552,7 +552,7 @@ CBotVar* CBotStack::CopyVar(CBotToken& Token, bool bUpdate)
|
|||
return pCopy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CBotStack::SetState(int n, int limite)
|
||||
{
|
||||
m_state = n;
|
||||
|
@ -609,7 +609,7 @@ bool CBotStack::Execute()
|
|||
while (p != NULL)
|
||||
{
|
||||
if ( p->m_next2 != NULL ) break;
|
||||
if ( p->m_call != NULL )
|
||||
if ( p->m_call != NULL )
|
||||
{
|
||||
instr = p->m_call;
|
||||
pile = p->m_prev ;
|
||||
|
@ -684,7 +684,7 @@ void CBotStack::AddVar(CBotVar* pVar)
|
|||
while (p != NULL && p->m_bBlock == 0) p = p->m_prev;
|
||||
|
||||
if ( p == NULL ) return;
|
||||
|
||||
|
||||
/// p->m_bDontDelete = bDontDelete;
|
||||
|
||||
CBotVar** pp = &p->m_listVar;
|
||||
|
@ -787,7 +787,7 @@ void CBotStack::GetRunPos(const char* &FunctionName, int &start, int &end)
|
|||
{
|
||||
if ( p->m_instr != NULL ) instr = p->m_instr;
|
||||
if ( p->m_bFunc == 1 ) funct = p->m_instr;
|
||||
if ( p->m_next->m_prog != prog ) break ;
|
||||
if ( p->m_next->m_prog != prog ) break ;
|
||||
|
||||
if (p->m_next2 && p->m_next2->m_state != 0) p = p->m_next2 ;
|
||||
else p = p->m_next;
|
||||
|
@ -818,7 +818,7 @@ CBotVar* CBotStack::GetStackVars(const char* &FunctionName, int level)
|
|||
|
||||
while (p->m_next != NULL)
|
||||
{
|
||||
if ( p->m_next->m_prog != prog ) break ;
|
||||
if ( p->m_next->m_prog != prog ) break ;
|
||||
|
||||
if (p->m_next2 && p->m_next2->m_state != 0) p = p->m_next2 ;
|
||||
else p = p->m_next;
|
||||
|
@ -848,7 +848,7 @@ CBotVar* CBotStack::GetStackVars(const char* &FunctionName, int level)
|
|||
|
||||
CBotToken* t = pp->m_instr->GetToken();
|
||||
FunctionName = t->GetString();
|
||||
|
||||
|
||||
return p->m_listVar;
|
||||
}
|
||||
|
||||
|
@ -872,8 +872,8 @@ bool CBotStack::SaveState(FILE* pf)
|
|||
if (!WriteWord(pf, m_state)) return false; // in what state?
|
||||
if (!WriteWord(pf, 0)) return false; // by compatibility m_bDontDelete
|
||||
if (!WriteWord(pf, m_step)) return false; // in what state?
|
||||
|
||||
|
||||
|
||||
|
||||
if (!SaveVar(pf, m_var)) return false; // current result
|
||||
if (!SaveVar(pf, m_listVar)) return false; // local variables
|
||||
|
||||
|
@ -921,7 +921,7 @@ bool CBotStack::RestoreState(FILE* pf, CBotStack* &pStack)
|
|||
|
||||
|
||||
bool CBotVar::Save0State(FILE* pf)
|
||||
{
|
||||
{
|
||||
if (!WriteWord(pf, 100+m_mPrivate))return false; // private variable?
|
||||
if (!WriteWord(pf, m_bStatic))return false; // static variable?
|
||||
if (!WriteWord(pf, m_type.GetType()))return false; // saves the type (always non-zero)
|
||||
|
@ -930,11 +930,11 @@ bool CBotVar::Save0State(FILE* pf)
|
|||
}
|
||||
|
||||
bool CBotVarInt::Save0State(FILE* pf)
|
||||
{
|
||||
{
|
||||
if ( !m_defnum.IsEmpty() )
|
||||
{
|
||||
if(!WriteWord(pf, 200 )) return false; // special marker
|
||||
if(!WriteString(pf, m_defnum)) return false; // name of the value
|
||||
if(!WriteString(pf, m_defnum)) return false; // name of the value
|
||||
}
|
||||
|
||||
return CBotVar::Save0State(pf);
|
||||
|
@ -1051,7 +1051,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
|
|||
if ( p != NULL )
|
||||
{
|
||||
delete pNew;
|
||||
pNew = p; // resume known element
|
||||
pNew = p; // resume known element
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1167,7 +1167,7 @@ CBotCStack* CBotCStack::TokenStack(CBotToken* pToken, bool bBlock)
|
|||
|
||||
|
||||
CBotInstr* CBotCStack::Return(CBotInstr* inst, CBotCStack* pfils)
|
||||
{
|
||||
{
|
||||
if ( pfils == this ) return inst;
|
||||
|
||||
if (m_var != NULL) delete m_var; // value replaced?
|
||||
|
@ -1185,7 +1185,7 @@ CBotInstr* CBotCStack::Return(CBotInstr* inst, CBotCStack* pfils)
|
|||
}
|
||||
|
||||
CBotFunction* CBotCStack::ReturnFunc(CBotFunction* inst, CBotCStack* pfils)
|
||||
{
|
||||
{
|
||||
if (m_var != NULL) delete m_var; // value replaced?
|
||||
m_var = pfils->m_var; // result transmitted
|
||||
pfils->m_var = NULL; // not to destroy the variable
|
||||
|
@ -1292,7 +1292,7 @@ bool CBotCStack::IsOk()
|
|||
return (m_error == 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CBotCStack::SetStartError( int pos )
|
||||
{
|
||||
if ( m_error != 0) return; // does not change existing error
|
||||
|
|
|
@ -161,7 +161,7 @@ CBotString::CBotString(const CBotString& srcString)
|
|||
int CBotString::GetLength()
|
||||
{
|
||||
if (m_ptr == NULL) return 0;
|
||||
return strlen( m_ptr );
|
||||
return strlen( m_ptr );
|
||||
}
|
||||
|
||||
|
||||
|
@ -336,7 +336,7 @@ const CBotString& CBotString::operator=(const CBotString& stringSrc)
|
|||
delete[] m_ptr;
|
||||
m_ptr = nullptr;
|
||||
|
||||
m_lg = stringSrc.m_lg;
|
||||
m_lg = stringSrc.m_lg;
|
||||
|
||||
if (m_lg > 0)
|
||||
{
|
||||
|
@ -373,7 +373,7 @@ const CBotString& CBotString::operator=(const char ch)
|
|||
{
|
||||
delete[] m_ptr;
|
||||
|
||||
m_lg = 1;
|
||||
m_lg = 1;
|
||||
|
||||
m_ptr = new char[2];
|
||||
m_ptr[0] = ch;
|
||||
|
@ -389,7 +389,7 @@ const CBotString& CBotString::operator=(const char* pString)
|
|||
|
||||
if (pString != nullptr)
|
||||
{
|
||||
m_lg = strlen(pString);
|
||||
m_lg = strlen(pString);
|
||||
|
||||
if (m_lg != 0)
|
||||
{
|
||||
|
@ -520,7 +520,7 @@ int CBotString::Compare(const char * lpsz) const
|
|||
char* p = m_ptr;
|
||||
if (lpsz == NULL) lpsz = emptyString;
|
||||
if (m_ptr == NULL) p = emptyString;
|
||||
return strcmp(p, lpsz); // wcscmp
|
||||
return strcmp(p, lpsz); // wcscmp
|
||||
}
|
||||
|
||||
const char * CBotString::MapIdToString(EID id)
|
||||
|
|
|
@ -472,7 +472,7 @@ void CBotToken::LoadKeyWords()
|
|||
{
|
||||
CBotString s;
|
||||
int i, n = 0;
|
||||
|
||||
|
||||
i = TokenKeyWord; //start with keywords of the language
|
||||
while (s.LoadString(i))
|
||||
{
|
||||
|
|
|
@ -36,3 +36,4 @@
|
|||
|
||||
extern bool IsOfType(CBotToken* &p, int type1, int type2 = -1);
|
||||
extern bool IsOfTypeList(CBotToken* &p, int type1, ...);
|
||||
|
||||
|
|
|
@ -63,10 +63,10 @@ CBotLogicExpr::~CBotLogicExpr()
|
|||
// acceptable type, operand
|
||||
// zero ends level \TODO précéance
|
||||
|
||||
static int ListOp[] =
|
||||
static int ListOp[] =
|
||||
{
|
||||
BOOLEEN, ID_LOGIC, 0,
|
||||
BOOLEEN, ID_TXT_OR,
|
||||
BOOLEEN, ID_TXT_OR,
|
||||
BOOLEEN, ID_LOG_OR, 0,
|
||||
BOOLEEN, ID_TXT_AND,
|
||||
BOOLEEN, ID_LOG_AND, 0,
|
||||
|
@ -76,7 +76,7 @@ static int ListOp[] =
|
|||
BOOLEEN|ENTIER|FLOTANT
|
||||
|CHAINE
|
||||
|POINTER
|
||||
|INSTANCE,ID_EQ,
|
||||
|INSTANCE,ID_EQ,
|
||||
BOOLEEN|ENTIER|FLOTANT
|
||||
|CHAINE
|
||||
|POINTER
|
||||
|
@ -90,8 +90,8 @@ static int ListOp[] =
|
|||
ENTIER, ID_ASR, 0,
|
||||
ENTIER|FLOTANT|CHAINE, ID_ADD,
|
||||
ENTIER|FLOTANT, ID_SUB, 0,
|
||||
ENTIER|FLOTANT, ID_MUL,
|
||||
ENTIER|FLOTANT, ID_DIV,
|
||||
ENTIER|FLOTANT, ID_MUL,
|
||||
ENTIER|FLOTANT, ID_DIV,
|
||||
ENTIER|FLOTANT, ID_MODULO, 0,
|
||||
ENTIER|FLOTANT, ID_POWER, 0,
|
||||
0,
|
||||
|
@ -194,7 +194,7 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera
|
|||
if ( NULL != (inst->m_rightop = CBotTwoOpExpr::Compile( p, pStk, pOp )) )
|
||||
// expression (...) right
|
||||
{
|
||||
// there is an second operand acceptable
|
||||
// there is an second operand acceptable
|
||||
|
||||
type2 = pStk->GetTypResult(); // what kind of results?
|
||||
|
||||
|
@ -327,7 +327,7 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
|
|||
}
|
||||
|
||||
|
||||
// requires a little more stack to avoid touching the result
|
||||
// requires a little more stack to avoid touching the result
|
||||
// of which is left on the stack, precisely
|
||||
|
||||
CBotStack* pStk2 = pStk1->AddStack(); // adds an item to the stack
|
||||
|
@ -566,3 +566,4 @@ void t(bool t)
|
|||
t ? 0 : "test";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -134,8 +134,8 @@ void CBotVarClass::InitCBotVarClass( const CBotToken* name, CBotTypResult& type
|
|||
m_LimExpr = NULL;
|
||||
m_pVar = NULL;
|
||||
m_type = type;
|
||||
if ( type.Eq(CBotTypArrayPointer) ) m_type.SetType( CBotTypArrayBody );
|
||||
else if ( !type.Eq(CBotTypArrayBody) ) m_type.SetType( CBotTypClass );
|
||||
if ( type.Eq(CBotTypArrayPointer) ) m_type.SetType( CBotTypArrayBody );
|
||||
else if ( !type.Eq(CBotTypArrayBody) ) m_type.SetType( CBotTypClass );
|
||||
// officel type for this object
|
||||
|
||||
m_pClass = NULL;
|
||||
|
@ -394,7 +394,7 @@ CBotVar* CBotVar::Create( const char* n, CBotTypResult type)
|
|||
CBotVarClass* instance = new CBotVarClass(&name, type);
|
||||
CBotVarArray* array = new CBotVarArray(&name, type);
|
||||
array->SetPointer( instance );
|
||||
|
||||
|
||||
CBotVar* pv = array;
|
||||
while (type.Eq(CBotTypArrayBody))
|
||||
{
|
||||
|
@ -414,14 +414,14 @@ CBotVar* CBotVar::Create( const char* name, int type, CBotClass* pClass)
|
|||
{
|
||||
CBotToken token( name, "" );
|
||||
CBotVar* pVar = Create( &token, type );
|
||||
|
||||
|
||||
if ( type == CBotTypPointer && pClass == NULL ) // pointer "null" ?
|
||||
return pVar;
|
||||
|
||||
if ( type == CBotTypClass || type == CBotTypPointer ||
|
||||
type == CBotTypIntrinsic )
|
||||
{
|
||||
if (pClass == NULL)
|
||||
if (pClass == NULL)
|
||||
{
|
||||
delete pVar;
|
||||
return NULL;
|
||||
|
@ -443,9 +443,9 @@ CBotTypResult CBotVar::GetTypResult(int mode)
|
|||
{
|
||||
CBotTypResult r = m_type;
|
||||
|
||||
if ( mode == 1 && m_type.Eq(CBotTypClass) )
|
||||
if ( mode == 1 && m_type.Eq(CBotTypClass) )
|
||||
r.SetType(CBotTypPointer);
|
||||
if ( mode == 2 && m_type.Eq(CBotTypClass) )
|
||||
if ( mode == 2 && m_type.Eq(CBotTypClass) )
|
||||
r.SetType(CBotTypIntrinsic);
|
||||
|
||||
return r;
|
||||
|
@ -453,9 +453,9 @@ CBotTypResult CBotVar::GetTypResult(int mode)
|
|||
|
||||
int CBotVar::GetType(int mode)
|
||||
{
|
||||
if ( mode == 1 && m_type.Eq(CBotTypClass) )
|
||||
if ( mode == 1 && m_type.Eq(CBotTypClass) )
|
||||
return CBotTypPointer;
|
||||
if ( mode == 2 && m_type.Eq(CBotTypClass) )
|
||||
if ( mode == 2 && m_type.Eq(CBotTypClass) )
|
||||
return CBotTypIntrinsic;
|
||||
return m_type.GetType();
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ void CBotVar::SetVal(CBotVar* var)
|
|||
ASM_TRAP();
|
||||
}
|
||||
|
||||
m_binit = var->m_binit; // copie l'état nan s'il y a
|
||||
m_binit = var->m_binit; // copie l'état nan s'il y a
|
||||
}
|
||||
|
||||
void CBotVar::SetStatic(bool bStatic)
|
||||
|
@ -1293,7 +1293,7 @@ void CBotVarBoolean::XOr(CBotVar* left, CBotVar* right)
|
|||
|
||||
void CBotVarBoolean::Not()
|
||||
{
|
||||
m_val = m_val ? false : true ;
|
||||
m_val = m_val ? false : true ;
|
||||
}
|
||||
|
||||
bool CBotVarBoolean::Eq(CBotVar* left, CBotVar* right)
|
||||
|
@ -1468,7 +1468,7 @@ void CBotVarClass::SetClass(CBotClass* pClass)//, int &nIdent)
|
|||
CBotInstr* p = pv->m_LimExpr; // the different formulas
|
||||
if ( p != NULL )
|
||||
{
|
||||
CBotStack* pile = CBotStack::FirstStack(); // an independent stack
|
||||
CBotStack* pile = CBotStack::FirstStack(); // an independent stack
|
||||
int n = 0;
|
||||
int max[100];
|
||||
|
||||
|
@ -1524,7 +1524,7 @@ CBotClass* CBotVarClass::GetClass()
|
|||
|
||||
void CBotVarClass::Maj(void* pUser, bool bContinu)
|
||||
{
|
||||
/* if (!bContinu && m_pMyThis != NULL)
|
||||
/* if (!bContinu && m_pMyThis != NULL)
|
||||
m_pMyThis->Maj(pUser, true);*/
|
||||
|
||||
// an update routine exist?
|
||||
|
@ -1671,7 +1671,7 @@ void CBotVarClass::IncrementUse()
|
|||
void CBotVarClass::DecrementUse()
|
||||
{
|
||||
m_CptUse--;
|
||||
if ( m_CptUse == 0 )
|
||||
if ( m_CptUse == 0 )
|
||||
{
|
||||
// if there is one, call the destructor
|
||||
// but only if a constructor had been called.
|
||||
|
@ -2025,7 +2025,7 @@ bool CBotVarPointer::Save1State(FILE* pf)
|
|||
|
||||
if (!WriteLong(pf, GetIdent())) return false; // the unique reference
|
||||
|
||||
// also saves the proceedings copies
|
||||
// also saves the proceedings copies
|
||||
return SaveVar(pf, GetPointer());
|
||||
}
|
||||
|
||||
|
@ -2082,7 +2082,7 @@ bool CBotVarPointer::Ne(CBotVar* left, CBotVar* right)
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// management of results types
|
||||
// management of results types
|
||||
|
||||
|
||||
CBotTypResult::CBotTypResult(int type)
|
||||
|
@ -2164,7 +2164,7 @@ int CBotTypResult::GetType(int mode) const
|
|||
|
||||
if ( m_pClass == NULL ) ASM_TRAP();
|
||||
|
||||
|
||||
|
||||
if ( m_type == CBotTypArrayPointer )
|
||||
if ( m_pNext == NULL ) ASM_TRAP();
|
||||
#endif
|
||||
|
@ -2245,4 +2245,3 @@ CBotTypResult&
|
|||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -112,16 +112,16 @@ bool CBotWhile :: Execute(CBotStack* &pj)
|
|||
// the condition is true, pass in the second mode
|
||||
|
||||
if (!pile->SetState(1)) return false; // ready for further
|
||||
|
||||
|
||||
case 1:
|
||||
// evaluates the associated statement block
|
||||
if ( m_Block != NULL &&
|
||||
if ( m_Block != NULL &&
|
||||
!m_Block->Execute(pile) )
|
||||
{
|
||||
if (pile->IfContinue(0, m_label)) continue; // if continued, will return to test
|
||||
return pj->BreakReturn(pile, m_label); // sends the results and releases the stack
|
||||
}
|
||||
|
||||
|
||||
// terminates if there is an error
|
||||
if ( !pile->IsOk() )
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ bool CBotWhile :: Execute(CBotStack* &pj)
|
|||
|
||||
// returns to the test again
|
||||
if (!pile->SetState(0, 0)) return false;
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,18 +140,18 @@ void CBotWhile :: RestoreState(CBotStack* &pj, bool bMain)
|
|||
CBotStack* pile = pj->RestoreStack(this); // adds an item to the stack
|
||||
if ( pile == NULL ) return;
|
||||
|
||||
switch( pile->GetState() )
|
||||
switch( pile->GetState() )
|
||||
{ // there are two possible states (depending on recovery)
|
||||
case 0:
|
||||
// evaluates the condition
|
||||
m_Condition->RestoreState(pile, bMain);
|
||||
m_Condition->RestoreState(pile, bMain);
|
||||
return;
|
||||
|
||||
|
||||
case 1:
|
||||
// evaluates the associated statement block
|
||||
if ( m_Block != NULL ) m_Block->RestoreState(pile, bMain);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -231,13 +231,13 @@ bool CBotDo :: Execute(CBotStack* &pj)
|
|||
{ // there are two possible states (depending on recovery)
|
||||
case 0:
|
||||
// evaluates the associated statement block
|
||||
if ( m_Block != NULL &&
|
||||
if ( m_Block != NULL &&
|
||||
!m_Block->Execute(pile) )
|
||||
{
|
||||
if (pile->IfContinue(1, m_label)) continue; // if continued, will return to test
|
||||
return pj->BreakReturn(pile, m_label); // sends the results and releases the stack
|
||||
}
|
||||
|
||||
|
||||
// terminates if there is an error
|
||||
if ( !pile->IsOk() )
|
||||
{
|
||||
|
@ -245,7 +245,7 @@ bool CBotDo :: Execute(CBotStack* &pj)
|
|||
}
|
||||
|
||||
if (!pile->SetState(1)) return false; // ready for further
|
||||
|
||||
|
||||
case 1:
|
||||
// evaluates the condition
|
||||
if ( !m_Condition->Execute(pile) ) return false; // interrupted here ?
|
||||
|
@ -260,7 +260,7 @@ bool CBotDo :: Execute(CBotStack* &pj)
|
|||
|
||||
// returns to instruction block to start
|
||||
if (!pile->SetState(0, 0)) return false;
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ void CBotDo :: RestoreState(CBotStack* &pj, bool bMain)
|
|||
// restores the assosiated statement's block
|
||||
if ( m_Block != NULL ) m_Block->RestoreState(pile, bMain);
|
||||
return;
|
||||
|
||||
|
||||
case 1:
|
||||
// restores the condition
|
||||
m_Condition->RestoreState(pile, bMain);
|
||||
|
@ -302,9 +302,9 @@ CBotFor::CBotFor()
|
|||
|
||||
CBotFor::~CBotFor()
|
||||
{
|
||||
delete m_Init;
|
||||
delete m_Test;
|
||||
delete m_Incr;
|
||||
delete m_Init;
|
||||
delete m_Test;
|
||||
delete m_Incr;
|
||||
delete m_Block; // frees the instruction block
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ bool CBotFor :: Execute(CBotStack* &pj)
|
|||
if ( m_Init != NULL &&
|
||||
!m_Init->Execute(pile) ) return false; // interrupted here ?
|
||||
if (!pile->SetState(1)) return false; // ready for further
|
||||
|
||||
|
||||
case 1:
|
||||
// evaluates the condition
|
||||
if ( m_Test != NULL ) // no strings attached? -> True!
|
||||
|
@ -404,10 +404,10 @@ bool CBotFor :: Execute(CBotStack* &pj)
|
|||
|
||||
// la condition est vrai, passe à la suite
|
||||
if (!pile->SetState(2)) return false; // ready for further
|
||||
|
||||
|
||||
case 2:
|
||||
// evaluates the associated statement block
|
||||
if ( m_Block != NULL &&
|
||||
if ( m_Block != NULL &&
|
||||
!m_Block->Execute(pile) )
|
||||
{
|
||||
if (pile->IfContinue(3, m_label)) continue; // if continued, going on to incrementation
|
||||
|
@ -429,7 +429,7 @@ bool CBotFor :: Execute(CBotStack* &pj)
|
|||
|
||||
// returns to the test again
|
||||
if (!pile->SetState(1, 0)) return false; // returns to the test
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,7 @@ void CBotFor :: RestoreState(CBotStack* &pj, bool bMain)
|
|||
// initialize
|
||||
if ( m_Init != NULL ) m_Init->RestoreState(pile, true); // interrupted here !
|
||||
return;
|
||||
|
||||
|
||||
case 1:
|
||||
if ( m_Init != NULL ) m_Init->RestoreState(pile, false); // variables definitions
|
||||
|
||||
|
@ -543,7 +543,7 @@ void CBotListExpression::RestoreState(CBotStack* &pj, bool bMain)
|
|||
{
|
||||
CBotStack* pile = pj;
|
||||
int state = 0x7000;
|
||||
|
||||
|
||||
if ( bMain )
|
||||
{
|
||||
pile = pj->RestoreStack();
|
||||
|
@ -615,7 +615,7 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
CBotInstr* i = CBotCase::Compile( p, pStk2 );
|
||||
if (i == NULL)
|
||||
{
|
||||
delete inst;
|
||||
delete inst;
|
||||
return pStack->Return(NULL, pStk2);
|
||||
}
|
||||
delete pStk2;
|
||||
|
@ -623,7 +623,7 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
else inst->m_Block->AddNext(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ( inst->m_Block == NULL )
|
||||
{
|
||||
pStk->SetError(TX_NOCASE, p->GetStart());
|
||||
|
@ -647,7 +647,7 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
}
|
||||
}
|
||||
DecLvl();
|
||||
|
||||
|
||||
if ( inst->m_Block == NULL )
|
||||
{
|
||||
pStk->SetError(TX_NOCASE, p->GetStart());
|
||||
|
@ -674,7 +674,7 @@ CBotInstr* CBotSwitch::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
|
||||
bool CBotSwitch :: Execute(CBotStack* &pj)
|
||||
{
|
||||
CBotStack* pile1 = pj->AddStack(this); // adds an item to the stack
|
||||
CBotStack* pile1 = pj->AddStack(this); // adds an item to the stack
|
||||
// if ( pile1 == EOX ) return true;
|
||||
|
||||
CBotInstr* p = m_Block; // first expression
|
||||
|
@ -723,7 +723,7 @@ void CBotSwitch :: RestoreState(CBotStack* &pj, bool bMain)
|
|||
{
|
||||
if ( !bMain ) return;
|
||||
|
||||
CBotStack* pile1 = pj->RestoreStack(this); // adds an item to the stack
|
||||
CBotStack* pile1 = pj->RestoreStack(this); // adds an item to the stack
|
||||
if ( pile1 == NULL ) return;
|
||||
|
||||
CBotInstr* p = m_Block; // first expression
|
||||
|
@ -912,7 +912,7 @@ CBotTry::~CBotTry()
|
|||
delete m_ListCatch; // frees the list
|
||||
delete m_Block; // frees the instruction block
|
||||
delete m_FinalInst;
|
||||
}
|
||||
}
|
||||
|
||||
CBotInstr* CBotTry::Compile(CBotToken* &p, CBotCStack* pStack)
|
||||
{
|
||||
|
@ -926,7 +926,7 @@ CBotInstr* CBotTry::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
|
||||
inst->m_Block = CBotBlock::CompileBlkOrInst( p, pStk );
|
||||
CBotCatch** pn = &inst->m_ListCatch;
|
||||
|
||||
|
||||
while (pStk->IsOk() && p->GetType() == ID_CATCH)
|
||||
{
|
||||
CBotCatch* i = CBotCatch::Compile(p, pStk);
|
||||
|
@ -1011,7 +1011,7 @@ bool CBotTry :: Execute(CBotStack* &pj)
|
|||
if ( !pc->Execute(pile2) ) return false; // performs the operation
|
||||
if ( m_FinalInst == NULL )
|
||||
return pj->Return(pile2); // ends the try
|
||||
|
||||
|
||||
pile1->SetState(-2); // passes final
|
||||
break;
|
||||
}
|
||||
|
@ -1019,13 +1019,13 @@ bool CBotTry :: Execute(CBotStack* &pj)
|
|||
}
|
||||
pc = pc->m_next;
|
||||
}
|
||||
if ( m_FinalInst != NULL &&
|
||||
if ( m_FinalInst != NULL &&
|
||||
pile1->GetState() > 0 && val != 0 ) pile1->SetState(-1);// if stop then made the final
|
||||
|
||||
if (pile1->GetState() <= -1)
|
||||
{
|
||||
// pile0->SetState(1);
|
||||
|
||||
|
||||
if (!m_FinalInst->Execute(pile2) && pile2->IsOk()) return false;
|
||||
if (!pile2->IsOk()) return pj->Return(pile2); // keep this exception
|
||||
pile2->SetError(pile1->GetState()==-1 ? val : 0); // gives the initial error
|
||||
|
@ -1176,7 +1176,7 @@ bool CBotCatch :: TestCatch(CBotStack* &pile, int val)
|
|||
var->SetValInt( pile->GetVal() == val );
|
||||
pile->SetVar(var); // calls on the stack
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,3 +21,4 @@ else()
|
|||
ARCHIVE DESTINATION ${COLOBOT_INSTALL_LIB_DIR}
|
||||
RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})
|
||||
endif()
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ void PrepareFilename(CBotString &filename) //DD!
|
|||
// gets the filename as a parameter
|
||||
|
||||
// execution
|
||||
bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
|
||||
bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
|
||||
{
|
||||
CBotString mode;
|
||||
|
||||
|
@ -239,7 +239,7 @@ CBotTypResult cfopen (CBotVar* pThis, CBotVar* &pVar)
|
|||
return CBotTypResult(CBotTypBoolean); //DR
|
||||
}
|
||||
|
||||
|
||||
|
||||
// FILE :: close method
|
||||
|
||||
// execution
|
||||
|
@ -291,7 +291,7 @@ bool rfwrite (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
|
|||
if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
|
||||
|
||||
FILE* pFile= (FILE*)pVar->GetValInt();
|
||||
|
||||
|
||||
int res = fputs(param+CBotString("\n"), pFile);
|
||||
|
||||
// on error throws an exception
|
||||
|
|
|
@ -184,10 +184,10 @@ bool rStrMid( CBotVar* pVar, CBotVar* pResult, int& ex, void* pUser )
|
|||
if ( pVar->GetNext() != NULL )
|
||||
{
|
||||
pVar = pVar->GetNext();
|
||||
|
||||
|
||||
// which must be a number
|
||||
if ( pVar->GetType() > CBotTypDouble ) { ex = TX_BADNUM ; return true; }
|
||||
|
||||
|
||||
// retrieves this number
|
||||
int l = pVar->GetValInt();
|
||||
|
||||
|
@ -231,7 +231,7 @@ CBotTypResult cStrStrIntInt( CBotVar* &pVar, void* pUser )
|
|||
// third parameter optional
|
||||
if ( pVar->GetNext() != NULL )
|
||||
{
|
||||
|
||||
|
||||
pVar = pVar->GetNext();
|
||||
// which must be a number
|
||||
if ( pVar->GetType() > CBotTypDouble )
|
||||
|
@ -434,3 +434,4 @@ void InitStringFunctions()
|
|||
CBotProgram::AddFunction("strupper", rStrUpper, cStrStr );
|
||||
CBotProgram::AddFunction("strlower", rStrLower, cStrStr );
|
||||
}
|
||||
|
||||
|
|
|
@ -39,3 +39,4 @@ the object being created with CBotVar :: Create (name, pClasse)
|
|||
not destroy the object when there imédiatement pointers
|
||||
but marked as virtually destroyed
|
||||
|
||||
|
||||
|
|
|
@ -176,3 +176,4 @@ enum EID
|
|||
#define TX_ERRWRITE 6015
|
||||
|
||||
#define TX_MAX 6016
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ endif()
|
|||
|
||||
# Additional libraries per platform
|
||||
if (${MXE}) # MXE requires special treatment
|
||||
set(PLATFORM_LIBS ${MXE_LIBS})
|
||||
set(PLATFORM_LIBS ${MXE_LIBS})
|
||||
elseif (${PLATFORM_WINDOWS})
|
||||
# because it isn't included in standard linking libraries
|
||||
set(PLATFORM_LIBS "-lintl")
|
||||
|
@ -229,3 +229,4 @@ target_link_libraries(colobot ${LIBS})
|
|||
|
||||
install(TARGETS colobot RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})
|
||||
set_target_properties(colobot PROPERTIES INSTALL_RPATH ${COLOBOT_INSTALL_LIB_DIR})
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
* \dir src/app
|
||||
* Main class of the application and system functions
|
||||
*/
|
||||
|
||||
|
|
|
@ -122,3 +122,4 @@ int SDL_MAIN_FUNC(int argc, char *argv[])
|
|||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
|
|
@ -188,12 +188,13 @@ float CSystemUtils::TimeStampDiff(SystemTimeStamp *before, SystemTimeStamp *afte
|
|||
return result;
|
||||
}
|
||||
|
||||
std::string CSystemUtils::profileFileLocation()
|
||||
std::string CSystemUtils::GetProfileFileLocation()
|
||||
{
|
||||
return std::string("colobot.ini");
|
||||
return std::string("colobot.ini");
|
||||
}
|
||||
|
||||
std::string CSystemUtils::savegameDirectoryLocation()
|
||||
std::string CSystemUtils::GetSavegameDirectoryLocation()
|
||||
{
|
||||
return std::string("savegame");
|
||||
return std::string("savegame");
|
||||
}
|
||||
|
||||
|
|
|
@ -131,10 +131,10 @@ public:
|
|||
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0;
|
||||
|
||||
//! Returns the profile (colobot.ini) file location
|
||||
virtual std::string profileFileLocation();
|
||||
virtual std::string GetProfileFileLocation();
|
||||
|
||||
//! Returns the savegame directory location
|
||||
virtual std::string savegameDirectoryLocation();
|
||||
virtual std::string GetSavegameDirectoryLocation();
|
||||
};
|
||||
|
||||
//! Global function to get CSystemUtils instance
|
||||
|
@ -142,3 +142,4 @@ inline CSystemUtils* GetSystemUtils()
|
|||
{
|
||||
return CSystemUtils::GetInstancePointer();
|
||||
}
|
||||
|
||||
|
|
|
@ -95,9 +95,9 @@ long long CSystemUtilsLinux::TimeStampExactDiff(SystemTimeStamp *before, SystemT
|
|||
(after->clockTime.tv_sec - before->clockTime.tv_sec) * 1000000000ll;
|
||||
}
|
||||
|
||||
std::string CSystemUtilsLinux::profileFileLocation()
|
||||
std::string CSystemUtilsLinux::GetProfileFileLocation()
|
||||
{
|
||||
std::string m_profileFile;
|
||||
std::string profileFile;
|
||||
|
||||
// Determine profileFile according to XDG Base Directory Specification
|
||||
char* envXDG_CONFIG_HOME = getenv("XDG_CONFIG_HOME");
|
||||
|
@ -106,25 +106,25 @@ std::string CSystemUtilsLinux::profileFileLocation()
|
|||
char *envHOME = getenv("HOME");
|
||||
if (envHOME == NULL)
|
||||
{
|
||||
m_profileFile = "colobot.ini";
|
||||
profileFile = "colobot.ini";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_profileFile = std::string(envHOME) + "/.config/colobot.ini";
|
||||
profileFile = std::string(envHOME) + "/.config/colobot.ini";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_profileFile = std::string(envXDG_CONFIG_HOME) + "/colobot.ini";
|
||||
profileFile = std::string(envXDG_CONFIG_HOME) + "/colobot.ini";
|
||||
}
|
||||
GetLogger()->Trace("Profile configuration is %s\n", m_profileFile.c_str());
|
||||
GetLogger()->Trace("Profile configuration is %s\n", profileFile.c_str());
|
||||
|
||||
return m_profileFile;
|
||||
return profileFile;
|
||||
}
|
||||
|
||||
std::string CSystemUtilsLinux::savegameDirectoryLocation()
|
||||
std::string CSystemUtilsLinux::GetSavegameDirectoryLocation()
|
||||
{
|
||||
std::string m_savegameDir;
|
||||
std::string savegameDir;
|
||||
|
||||
// Determine savegame dir according to XDG Base Directory Specification
|
||||
char *envXDG_DATA_HOME = getenv("XDG_CONFIG_DATA");
|
||||
|
@ -133,18 +133,19 @@ std::string CSystemUtilsLinux::savegameDirectoryLocation()
|
|||
char *envHOME = getenv("HOME");
|
||||
if (envHOME == NULL)
|
||||
{
|
||||
m_savegameDir = "/tmp/colobot-savegame";
|
||||
savegameDir = "/tmp/colobot-savegame";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_savegameDir = std::string(envHOME) + "/.local/share/colobot";
|
||||
{
|
||||
savegameDir = std::string(envHOME) + "/.local/share/colobot";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_savegameDir = std::string(envXDG_DATA_HOME) + "/colobot";
|
||||
savegameDir = std::string(envXDG_DATA_HOME) + "/colobot";
|
||||
}
|
||||
GetLogger()->Trace("Saved game files are going to %s\n", m_savegameDir.c_str());
|
||||
GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str());
|
||||
|
||||
return m_savegameDir;
|
||||
return savegameDir;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,9 +46,10 @@ public:
|
|||
virtual long long GetTimeStampExactResolution() override;
|
||||
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
|
||||
|
||||
virtual std::string profileFileLocation() override;
|
||||
virtual std::string savegameDirectoryLocation() override;
|
||||
virtual std::string GetProfileFileLocation() override;
|
||||
virtual std::string GetSavegameDirectoryLocation() override;
|
||||
|
||||
private:
|
||||
bool m_zenityAvailable;
|
||||
};
|
||||
|
||||
|
|
|
@ -37,3 +37,4 @@ long long int CSystemUtilsOther::TimeStampExactDiff(SystemTimeStamp* before, Sys
|
|||
{
|
||||
return (after->sdlTicks - before->sdlTicks) * 1000000ll;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,3 +46,4 @@ public:
|
|||
virtual long long GetTimeStampExactResolution() override;
|
||||
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -111,38 +111,39 @@ std::wstring CSystemUtilsWindows::UTF8_Decode(const std::string& str)
|
|||
|
||||
}
|
||||
|
||||
std::string CSystemUtilsWindows::profileFileLocation()
|
||||
std::string CSystemUtilsWindows::GetProfileFileLocation()
|
||||
{
|
||||
std::string m_profileFile;
|
||||
std::string profileFile;
|
||||
|
||||
char* envUSERPROFILE = getenv("USERPROFILE");
|
||||
if (envUSERPROFILE == NULL)
|
||||
{
|
||||
m_profileFile = "colobot.ini";
|
||||
profileFile = "colobot.ini";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_profileFile = std::string(envUSERPROFILE) + "\\colobot\\colobot.ini";
|
||||
profileFile = std::string(envUSERPROFILE) + "\\colobot\\colobot.ini";
|
||||
}
|
||||
GetLogger()->Trace("Profile configuration is %s\n", m_profileFile.c_str());
|
||||
GetLogger()->Trace("Profile configuration is %s\n", profileFile.c_str());
|
||||
|
||||
return m_profileFile;
|
||||
return profileFile;
|
||||
}
|
||||
|
||||
std::string CSystemUtilsWindows::savegameDirectoryLocation()
|
||||
std::string CSystemUtilsWindows::GetSavegameDirectoryLocation()
|
||||
{
|
||||
std::string m_savegameDir;
|
||||
std::string savegameDir;
|
||||
|
||||
char* envUSERPROFILE = getenv("USERPROFILE");
|
||||
if (envUSERPROFILE == NULL)
|
||||
{
|
||||
m_savegameDir = "savegame";
|
||||
savegameDir = "savegame";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_savegameDir = std::string(envUSERPROFILE) + "\\colobot\\savegame";
|
||||
savegameDir = std::string(envUSERPROFILE) + "\\colobot\\savegame";
|
||||
}
|
||||
GetLogger()->Trace("Saved game files are going to %s\n", m_savegameDir.c_str());
|
||||
GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str());
|
||||
|
||||
return savegameDir;
|
||||
}
|
||||
|
||||
return m_savegameDir;
|
||||
}
|
|
@ -44,8 +44,8 @@ public:
|
|||
virtual long long GetTimeStampExactResolution() override;
|
||||
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
|
||||
|
||||
virtual std::string profileFileLocation() override;
|
||||
virtual std::string savegameDirectoryLocation() override;
|
||||
virtual std::string GetProfileFileLocation() override;
|
||||
virtual std::string GetSavegameDirectoryLocation() override;
|
||||
|
||||
private:
|
||||
std::string UTF8_Encode(const std::wstring &wstr);
|
||||
|
@ -54,3 +54,4 @@ private:
|
|||
protected:
|
||||
long long m_counterFrequency;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
* \dir src/common
|
||||
* \brief Structs and utils shared throughout the application
|
||||
*/
|
||||
|
||||
|
|
|
@ -23,3 +23,4 @@
|
|||
|
||||
#define COLOBOT_DEFAULT_DATADIR "@COLOBOT_INSTALL_DATA_DIR@"
|
||||
#define COLOBOT_I18N_DIR "@COLOBOT_INSTALL_I18N_DIR@"
|
||||
|
||||
|
|
|
@ -779,3 +779,4 @@ protected:
|
|||
int m_tail;
|
||||
int m_total;
|
||||
};
|
||||
|
||||
|
|
|
@ -297,3 +297,4 @@ extern int g_build; // constructible buildings
|
|||
extern int g_researchDone; // research done
|
||||
extern long g_researchEnable; // research available
|
||||
extern float g_unit; // conversion factor
|
||||
|
||||
|
|
|
@ -110,7 +110,8 @@ bool PNGSaveSurface(const char *filename, SDL_Surface *surf)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr))) {
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
fclose(fp);
|
||||
return false;
|
||||
|
@ -396,3 +397,4 @@ bool CImage::SavePNG(const std::string& fileName)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,3 +112,4 @@ private:
|
|||
//! Image data
|
||||
ImageData* m_data;
|
||||
};
|
||||
|
||||
|
|
|
@ -111,3 +111,4 @@ void CInstanceManager::Compress(ManagedClassType classType)
|
|||
}
|
||||
m_table[classType].usedCount = j;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,4 +93,3 @@ protected:
|
|||
ManagedClassInstances m_table[CLASS_MAX];
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -146,3 +146,4 @@ std::string ReadBinaryString(std::istream &istr)
|
|||
}
|
||||
|
||||
}; // namespace IOUtils
|
||||
|
||||
|
|
|
@ -61,3 +61,4 @@ enum VirtualKmod
|
|||
|
||||
//! Special value for invalid key bindings
|
||||
const unsigned int KEY_INVALID = SDLK_LAST + 1000;
|
||||
|
||||
|
|
|
@ -125,6 +125,8 @@ private:
|
|||
|
||||
|
||||
//! Global function to get Logger instance
|
||||
inline CLogger* GetLogger() {
|
||||
inline CLogger* GetLogger()
|
||||
{
|
||||
return CLogger::GetInstancePointer();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,3 +31,4 @@ extern void TimeToAscii(time_t time, char *buffer);
|
|||
|
||||
extern bool CopyFileListToTemp(char* filename, int* list, int total);
|
||||
extern void AddExt(char* filename, const char* ext);
|
||||
|
||||
|
|
|
@ -47,8 +47,9 @@ bool CProfile::InitCurrentDirectory()
|
|||
{
|
||||
try
|
||||
{
|
||||
// TODO: NDEBUG should be replaced with something like BUILD_TYPE == "DEBUG"/"RELEASE"
|
||||
#ifdef NDEBUG
|
||||
bp::ini_parser::read_ini(GetSystemUtils()->profileFileLocation(), m_propertyTree);
|
||||
bp::ini_parser::read_ini(GetSystemUtils()->GetProfileFileLocation(), m_propertyTree);
|
||||
#else
|
||||
bp::ini_parser::read_ini("colobot.ini", m_propertyTree);
|
||||
#endif
|
||||
|
@ -68,7 +69,7 @@ bool CProfile::SaveCurrentDirectory()
|
|||
try
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
bp::ini_parser::write_ini(GetSystemUtils()->profileFileLocation(), m_propertyTree);
|
||||
bp::ini_parser::write_ini(GetSystemUtils()->GetProfileFileLocation(), m_propertyTree);
|
||||
#else
|
||||
bp::ini_parser::write_ini("colobot.ini", m_propertyTree);
|
||||
#endif
|
||||
|
@ -209,34 +210,39 @@ std::string CProfile::GetUserBasedPath(std::string dir, std::string default_dir)
|
|||
{
|
||||
std::string path = dir;
|
||||
boost::replace_all(path, "\\", "/");
|
||||
if (dir.find("/") == std::string::npos) {
|
||||
if (dir.find("/") == std::string::npos)
|
||||
{
|
||||
path = default_dir + "/" + dir;
|
||||
}
|
||||
|
||||
if (m_userDirectory.length() > 0) {
|
||||
|
||||
if (m_userDirectory.length() > 0)
|
||||
{
|
||||
boost::replace_all(path, "%user%", m_userDirectory);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::replace_all(path, "%user%", default_dir);
|
||||
}
|
||||
|
||||
|
||||
return fs::path(path).make_preferred().string();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool CProfile::CopyFileToTemp(std::string filename)
|
||||
{
|
||||
std::string src, dst;
|
||||
std::string tmp_user_dir = m_userDirectory;
|
||||
|
||||
|
||||
src = GetUserBasedPath(filename, "textures");
|
||||
SetUserDir("temp");
|
||||
dst = GetUserBasedPath(filename, "textures");
|
||||
SetUserDir(tmp_user_dir);
|
||||
|
||||
|
||||
fs::create_directory(fs::path(dst).parent_path().make_preferred().string());
|
||||
fs::copy_file(src, dst, fs::copy_option::overwrite_if_exists);
|
||||
if (fs::exists(dst)) {
|
||||
return true;
|
||||
if (fs::exists(dst))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -41,101 +41,103 @@ namespace fs = boost::filesystem;
|
|||
*/
|
||||
class CProfile : public CSingleton<CProfile>
|
||||
{
|
||||
public:
|
||||
CProfile();
|
||||
~CProfile();
|
||||
public:
|
||||
CProfile();
|
||||
~CProfile();
|
||||
|
||||
/** Loads colobot.ini from current directory
|
||||
* \return return true on success
|
||||
*/
|
||||
bool InitCurrentDirectory();
|
||||
/** Loads colobot.ini from current directory
|
||||
* \return return true on success
|
||||
*/
|
||||
bool InitCurrentDirectory();
|
||||
|
||||
/** Saves colobot.ini to current directory
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SaveCurrentDirectory();
|
||||
/** Saves colobot.ini to current directory
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SaveCurrentDirectory();
|
||||
|
||||
/** Sets string value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetLocalProfileString(std::string section, std::string key, std::string value);
|
||||
/** Sets string value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetLocalProfileString(std::string section, std::string key, std::string value);
|
||||
|
||||
/** Gets string value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param buffer
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetLocalProfileString(std::string section, std::string key, std::string& buffer);
|
||||
/** Gets string value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param buffer
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetLocalProfileString(std::string section, std::string key, std::string& buffer);
|
||||
|
||||
/** Sets int value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetLocalProfileInt(std::string section, std::string key, int value);
|
||||
/** Sets int value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetLocalProfileInt(std::string section, std::string key, int value);
|
||||
|
||||
/** Gets int value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetLocalProfileInt(std::string section, std::string key, int &value);
|
||||
/** Gets int value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetLocalProfileInt(std::string section, std::string key, int &value);
|
||||
|
||||
/** Sets float value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetLocalProfileFloat(std::string section, std::string key, float value);
|
||||
/** Sets float value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetLocalProfileFloat(std::string section, std::string key, float value);
|
||||
|
||||
/** Gets float value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetLocalProfileFloat(std::string section, std::string key, float &value);
|
||||
/** Gets float value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetLocalProfileFloat(std::string section, std::string key, float &value);
|
||||
|
||||
/** Gets all values in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \return vector of values
|
||||
*/
|
||||
std::vector< std::string > GetLocalProfileSection(std::string section, std::string key);
|
||||
|
||||
/** Sets current user directory
|
||||
* \param dir
|
||||
*/
|
||||
void SetUserDir(std::string dir);
|
||||
|
||||
/** Returns path based on current user. Replaces %user% in path with current user dir or
|
||||
* uses default_dir param if no user dir is specified
|
||||
* \param dir
|
||||
* \param default_dir
|
||||
* \return path
|
||||
*/
|
||||
std::string GetUserBasedPath(std::string dir, std::string default_dir);
|
||||
|
||||
/** opy a file into the temporary folder.
|
||||
* \param filename
|
||||
* \return true on success
|
||||
*/
|
||||
bool CopyFileToTemp(std::string filename);
|
||||
/** Gets all values in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \return vector of values
|
||||
*/
|
||||
std::vector< std::string > GetLocalProfileSection(std::string section, std::string key);
|
||||
|
||||
private:
|
||||
boost::property_tree::ptree m_propertyTree;
|
||||
bool m_profileNeedSave;
|
||||
std::string m_userDirectory;
|
||||
/** Sets current user directory
|
||||
* \param dir
|
||||
*/
|
||||
void SetUserDir(std::string dir);
|
||||
|
||||
/** Returns path based on current user. Replaces %user% in path with current user dir or
|
||||
* uses default_dir param if no user dir is specified
|
||||
* \param dir
|
||||
* \param default_dir
|
||||
* \return path
|
||||
*/
|
||||
std::string GetUserBasedPath(std::string dir, std::string default_dir);
|
||||
|
||||
/** opy a file into the temporary folder.
|
||||
* \param filename
|
||||
* \return true on success
|
||||
*/
|
||||
bool CopyFileToTemp(std::string filename);
|
||||
|
||||
private:
|
||||
boost::property_tree::ptree m_propertyTree;
|
||||
bool m_profileNeedSave;
|
||||
std::string m_userDirectory;
|
||||
};
|
||||
|
||||
//! Global function to get profile instance
|
||||
inline CProfile & GetProfile() {
|
||||
inline CProfile & GetProfile()
|
||||
{
|
||||
return *CProfile::GetInstancePointer();
|
||||
}
|
||||
|
||||
|
|
|
@ -920,3 +920,4 @@ bool GetResource(ResType type, int num, char* text)
|
|||
PutKeyName(text, tmpl);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -158,3 +158,4 @@ void InitializeRestext();
|
|||
void SetGlobalGamerName(std::string name);
|
||||
bool SearchKey(const char *cmd, InputSlot& slot);
|
||||
bool GetResource(ResType type, int num, char* text);
|
||||
|
||||
|
|
|
@ -74,3 +74,4 @@ private:
|
|||
CSingleton& operator=(const CSingleton<T> &);
|
||||
CSingleton(const CSingleton<T> &);
|
||||
};
|
||||
|
||||
|
|
|
@ -142,3 +142,4 @@ size_t StrUtils::Utf8StringLength(const std::string &str)
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,3 +78,4 @@ int Utf8CharSizeAt(const std::string &str, unsigned int pos);
|
|||
size_t Utf8StringLength(const std::string &str);
|
||||
|
||||
}; // namespace StrUtil
|
||||
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
lang/
|
||||
|
||||
|
|
|
@ -3,72 +3,72 @@ cmake_minimum_required(VERSION 2.8)
|
|||
# Install Desktop Entry file
|
||||
set(COLOBOT_DESKTOP_FILE colobot.desktop)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}
|
||||
COMMAND ./create_desktop_file.sh > ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
COMMENT "Build ${COLOBOT_DESKTOP_FILE}"
|
||||
)
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}
|
||||
COMMAND ./create_desktop_file.sh > ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
COMMENT "Build ${COLOBOT_DESKTOP_FILE}"
|
||||
)
|
||||
add_custom_target(desktopfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE})
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications/
|
||||
)
|
||||
)
|
||||
|
||||
# Install Icon
|
||||
set(COLOBOT_ICON_FILE colobot.svg)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
|
||||
)
|
||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
|
||||
)
|
||||
|
||||
# Render SVG icon in various sizes
|
||||
find_program(RSVG_CONVERT rsvg-convert)
|
||||
if(RSVG_CONVERT)
|
||||
foreach(PNGSIZE "48" "32" "16")
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE})
|
||||
add_custom_target(resize_icon_${PNGSIZE} ALL
|
||||
COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE}
|
||||
> ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/
|
||||
)
|
||||
endforeach()
|
||||
foreach(PNGSIZE "48" "32" "16")
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE})
|
||||
add_custom_target(resize_icon_${PNGSIZE} ALL
|
||||
COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE}
|
||||
> ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Create manpage from pod-formatted file
|
||||
find_program(POD2MAN pod2man)
|
||||
if(POD2MAN AND (NOT MSYS))
|
||||
set(COLOBOT_MANPAGE_SECTION 6)
|
||||
set(COLOBOT_MANPAGE_SECTION 6)
|
||||
|
||||
macro(podman)
|
||||
cmake_parse_arguments(PM "" "PODFILE;LOCALE;" "" ${ARGN})
|
||||
if(PM_LOCALE)
|
||||
# This copes with the fact that english has no "/LANG" in the paths and filenames.
|
||||
set(SLASHLOCALE /${PM_LOCALE})
|
||||
endif()
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE})
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
|
||||
cmake_parse_arguments(PM "" "PODFILE;LOCALE;" "" ${ARGN})
|
||||
if(PM_LOCALE)
|
||||
# This copes with the fact that english has no "/LANG" in the paths and filenames.
|
||||
set(SLASHLOCALE /${PM_LOCALE})
|
||||
endif()
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE})
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE}
|
||||
COMMAND ${POD2MAN} ARGS --section=${COLOBOT_MANPAGE_SECTION}
|
||||
--center="Colobot" --stderr --utf8
|
||||
--release="${COLOBOT_VERSION_FULL}"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE}
|
||||
${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
|
||||
COMMENT "Create ${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} manpage"
|
||||
COMMENT "Create ${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} manpage"
|
||||
)
|
||||
add_custom_target(man${PM_LOCALE} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION})
|
||||
add_custom_target(man${PM_LOCALE} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION})
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man${SLASHLOCALE}/man${COLOBOT_MANPAGE_SECTION}/ )
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man${SLASHLOCALE}/man${COLOBOT_MANPAGE_SECTION}/ )
|
||||
|
||||
add_dependencies(man man${PM_LOCALE})
|
||||
endmacro()
|
||||
add_dependencies(man man${PM_LOCALE})
|
||||
endmacro()
|
||||
|
||||
# Create the english manpage
|
||||
podman(PODFILE colobot.pod)
|
||||
# Create the english manpage
|
||||
podman(PODFILE colobot.pod)
|
||||
|
||||
endif()
|
||||
|
||||
|
@ -76,22 +76,23 @@ endif()
|
|||
find_program(PO4A po4a)
|
||||
|
||||
if(PO4A)
|
||||
add_custom_target(desktop_po4a
|
||||
COMMAND ${PO4A} po4a.cfg
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
add_dependencies(desktopfile desktop_po4a)
|
||||
add_custom_target(desktop_po4a
|
||||
COMMAND ${PO4A} po4a.cfg
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
add_dependencies(desktopfile desktop_po4a)
|
||||
|
||||
if(POD2MAN)
|
||||
add_custom_target(man_po4a
|
||||
COMMAND ${PO4A} po4a.cfg
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
add_dependencies(man man_po4a)
|
||||
file(GLOB LINGUAS_PO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po/ ${CMAKE_CURRENT_SOURCE_DIR}/po/*.po)
|
||||
string(REGEX REPLACE ".po$" "" LINGUAS ${LINGUAS_PO})
|
||||
foreach(LOCALE ${LINGUAS})
|
||||
podman(PODFILE lang/${LOCALE}/colobot.pod LOCALE ${LOCALE})
|
||||
endforeach()
|
||||
endif()
|
||||
if(POD2MAN)
|
||||
add_custom_target(man_po4a
|
||||
COMMAND ${PO4A} po4a.cfg
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
add_dependencies(man man_po4a)
|
||||
file(GLOB LINGUAS_PO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po/ ${CMAKE_CURRENT_SOURCE_DIR}/po/*.po)
|
||||
string(REGEX REPLACE ".po$" "" LINGUAS ${LINGUAS_PO})
|
||||
foreach(LOCALE ${LINGUAS})
|
||||
podman(PODFILE lang/${LOCALE}/colobot.pod LOCALE ${LOCALE})
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -4,3 +4,4 @@ Type=Application
|
|||
Exec=colobot
|
||||
Icon=colobot
|
||||
Categories=Education;Robotics;Game;AdventureGame;StrategyGame;
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Name="Colobot"
|
||||
GenericName="Game to learn programming"
|
||||
Comment="Colonize with bots"
|
||||
|
||||
|
|
|
@ -45,3 +45,4 @@ Set language. Note that you can also fill the B<LANG> environment variable.
|
|||
=head1 AUTHOR
|
||||
|
||||
This manpage was written by Didier Raboud <S<odyx@debian.org>>.
|
||||
|
||||
|
|
|
@ -236,3 +236,4 @@
|
|||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
|
@ -11,8 +11,8 @@ cat colobot.desktop.in
|
|||
linguas=$([ ! -d lang ] || ( cd lang ; ls));
|
||||
|
||||
for type in Name GenericName Comment; do
|
||||
egrep "^$type=" $fname | sed -e "s/^$type=\"\(.*\)\"$/$type=\1/g"
|
||||
for l in $linguas; do
|
||||
egrep "^$type=" lang/$l/$fname | sed -e "s/^$type=\"\(.*\)\"$/$type[$l]=\1/g"
|
||||
done
|
||||
egrep "^$type=" $fname | sed -e "s/^$type=\"\(.*\)\"$/$type=\1/g"
|
||||
for l in $linguas; do
|
||||
egrep "^$type=" lang/$l/$fname | sed -e "s/^$type=\"\(.*\)\"$/$type[$l]=\1/g"
|
||||
done
|
||||
done
|
||||
|
|
|
@ -132,3 +132,4 @@ msgstr ""
|
|||
#: colobot.pod:47
|
||||
msgid "This manpage was written by Didier Raboud <S<odyx@debian.org>>."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
[type:ini] colobot.ini $lang:lang/$lang/colobot.ini
|
||||
[type:pod] colobot.pod $lang:lang/$lang/colobot.pod
|
||||
|
||||
|
|
|
@ -10,3 +10,4 @@
|
|||
* This namespace was created to avoid clashing with old code, but now it still serves,
|
||||
* defining a border between pure graphics engine and other parts of application.
|
||||
*/
|
||||
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
*
|
||||
* Core types, enums, structs and CDevice abstract class that define
|
||||
* the abstract graphics device used in graphics engine
|
||||
*/
|
||||
*/
|
||||
|
||||
|
|
|
@ -106,3 +106,4 @@ Color HSV2RGB(ColorHSV color)
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -154,3 +154,4 @@ Color HSV2RGB(ColorHSV color);
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -401,3 +401,4 @@ public:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -98,3 +98,4 @@ struct Light
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -60,3 +60,4 @@ struct Material
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -269,3 +269,4 @@ struct Texture
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -140,3 +140,4 @@ struct VertexTex2
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
Possible future DirectX implementation of graphics engine
|
||||
|
||||
|
|
|
@ -7,3 +7,4 @@
|
|||
*
|
||||
* Graphics operations are done on abstract interface from src/graphics/core
|
||||
*/
|
||||
|
||||
|
|
|
@ -1676,3 +1676,4 @@ Math::Vector CCamera::ExcludeObject(Math::Vector eye, Math::Vector lookat,
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -128,8 +128,7 @@ enum CameraOverEffect
|
|||
|
||||
... */
|
||||
class CCamera {
|
||||
|
||||
public:
|
||||
public:
|
||||
CCamera();
|
||||
~CCamera();
|
||||
|
||||
|
@ -391,3 +390,4 @@ protected:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -270,3 +270,4 @@ bool CCloud::GetEnabled()
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -140,3 +140,4 @@ protected:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -4332,3 +4332,4 @@ void CEngine::DrawStats()
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -1431,3 +1431,4 @@ protected:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -465,3 +465,4 @@ bool CLightManager::LightsComparator::operator()(const DynamicLight& left, const
|
|||
}
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -216,3 +216,4 @@ protected:
|
|||
};
|
||||
|
||||
}; // namespace Gfx
|
||||
|
||||
|
|
|
@ -418,3 +418,4 @@ CObject* CLightning::SearchObject(Math::Vector pos)
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -107,3 +107,4 @@ protected:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -1199,3 +1199,4 @@ int CModelFile::GetTriangleCount()
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -150,3 +150,4 @@ protected:
|
|||
};
|
||||
|
||||
}; // namespace Gfx
|
||||
|
||||
|
|
|
@ -201,3 +201,4 @@ float CModelManager::GetHeight(std::vector<ModelTriangle>& triangles, Math::Vect
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -99,3 +99,4 @@ private:
|
|||
};
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -3917,3 +3917,4 @@ bool CParticle::WriteWheelTrace(const char *filename, int width, int height,
|
|||
}
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -395,3 +395,4 @@ protected:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -185,3 +185,4 @@ int CPlanet::GetMode()
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -118,3 +118,4 @@ protected:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -2399,3 +2399,4 @@ void CPyro::LightOperFrame(float rTime)
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -219,3 +219,4 @@ protected:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -1801,3 +1801,4 @@ float CTerrain::GetFlyingLimit(Math::Vector pos, bool noLimit)
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -418,3 +418,4 @@ protected:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -25,3 +25,4 @@ add_executable(modelfile_test ${MODELFILE_TEST_SOURCES})
|
|||
target_link_libraries(modelfile_test gtest)
|
||||
|
||||
add_test(modelfile_test modelfile_test)
|
||||
|
||||
|
|
|
@ -260,3 +260,4 @@ int main(int argc, char **argv)
|
|||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
|
|
|
@ -913,3 +913,4 @@ CharTexture CText::CreateCharTexture(UTF8Char ch, CachedFont* font)
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -342,3 +342,4 @@ protected:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -628,3 +628,4 @@ void CWater::AdjustEye(Math::Vector &eye)
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -204,3 +204,4 @@ protected:
|
|||
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
* Contains the concrete implementation using OpenGL of abstract CDevice class
|
||||
* from src/graphics/core
|
||||
*/
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue