Some more random refactoring in CBot
parent
fa92605225
commit
2245863fcd
|
@ -189,7 +189,7 @@ CBotInstr* CBotDefClass::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* p
|
|||
}
|
||||
else if (inst->m_hasParams)
|
||||
{
|
||||
// creates the object on the "job" (\TODO "tas")
|
||||
// creates the object on the stack
|
||||
// with a pointer to the object
|
||||
if ( !bIntrinsic )
|
||||
{
|
||||
|
@ -406,7 +406,7 @@ void CBotDefClass::RestoreState(CBotStack* &pj, bool bMain)
|
|||
CBotInstr* p = m_parameters;
|
||||
// evaluates the parameters
|
||||
// and the values an the stack
|
||||
// for the ability to be interrupted at any time (\TODO pour pouvoir être interrompu n'importe quand)
|
||||
// so that it can be interrupted at any time
|
||||
|
||||
if ( p != nullptr) while ( true )
|
||||
{
|
||||
|
|
|
@ -284,7 +284,8 @@ bool CBotExprVar::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* prevToke
|
|||
pVar = pj->FindVar(m_nIdent, true); // tries with the variable update if necessary
|
||||
if (pVar == nullptr)
|
||||
{
|
||||
pj->SetError(static_cast<CBotError>(1), &m_token); // TODO: yeah, don't care that this exception doesn't exist ~krzys_h
|
||||
assert(false);
|
||||
//pj->SetError(static_cast<CBotError>(1), &m_token); // TODO: yeah, don't care that this exception doesn't exist ~krzys_h
|
||||
return false;
|
||||
}
|
||||
if ( m_next3 != nullptr &&
|
||||
|
|
|
@ -766,7 +766,7 @@ int CBotFunction::DoCall(long& nIdent, const std::string& name, CBotVar* pThis,
|
|||
if ( pt->m_bSynchro )
|
||||
{
|
||||
CBotProgram* pProgBase = pStk->GetProgram(true);
|
||||
if ( !pClass->Lock(pProgBase) ) return false; // expected to power \TODO attend de pouvoir
|
||||
if ( !pClass->Lock(pProgBase) ) return false; // try to lock, interrupt if failed
|
||||
}
|
||||
pStk->IncState();
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ bool CBotInstrCall::Execute(CBotStack* &pj)
|
|||
if ( pile->GetState() == 0 )
|
||||
{
|
||||
if (!p->Execute(pile)) return false; // interrupted here?
|
||||
pile->SetState(1); // mark as special for reknowed parameters \TODO marque spéciale pour reconnaîre parameters
|
||||
pile->SetState(1); // set state to remember that parameters were executed
|
||||
}
|
||||
ppVars[i++] = pile->GetVar();
|
||||
p = p->GetNext();
|
||||
|
|
|
@ -50,52 +50,47 @@ CBotInstr* CBotInstrMethode::Compile(CBotToken* &p, CBotCStack* pStack, CBotVar*
|
|||
CBotInstrMethode* inst = new CBotInstrMethode();
|
||||
inst->SetToken(p); // corresponding token
|
||||
|
||||
if (nullptr != var)
|
||||
CBotToken* pp = p;
|
||||
p = p->GetNext();
|
||||
|
||||
if (p->GetType() == ID_OPENPAR)
|
||||
{
|
||||
CBotToken* pp = p;
|
||||
p = p->GetNext();
|
||||
inst->m_methodName = pp->GetString();
|
||||
|
||||
if (p->GetType() == ID_OPENPAR)
|
||||
// compiles the list of parameters
|
||||
CBotVar* ppVars[1000];
|
||||
inst->m_parameters = CompileParams(p, pStack, ppVars);
|
||||
|
||||
if (pStack->IsOk())
|
||||
{
|
||||
inst->m_methodName = pp->GetString();
|
||||
CBotClass* pClass = var->GetClass(); // pointer to the class
|
||||
inst->m_className = pClass->GetName(); // name of the class
|
||||
CBotTypResult r = pClass->CompileMethode(inst->m_methodName, var, ppVars,
|
||||
pStack, inst->m_MethodeIdent);
|
||||
delete pStack->TokenStack(); // release parameters on the stack
|
||||
inst->m_typRes = r;
|
||||
|
||||
// compiles the list of parameters
|
||||
CBotVar* ppVars[1000];
|
||||
inst->m_parameters = CompileParams(p, pStack, ppVars);
|
||||
|
||||
if (pStack->IsOk())
|
||||
if (inst->m_typRes.GetType() > 20)
|
||||
{
|
||||
CBotClass* pClass = var->GetClass(); // pointer to the class
|
||||
inst->m_className = pClass->GetName(); // name of the class
|
||||
CBotTypResult r = pClass->CompileMethode(inst->m_methodName, var, ppVars,
|
||||
pStack, inst->m_MethodeIdent);
|
||||
delete pStack->TokenStack(); // release parameters on the stack
|
||||
inst->m_typRes = r;
|
||||
|
||||
if (inst->m_typRes.GetType() > 20)
|
||||
{
|
||||
pStack->SetError(static_cast<CBotError>(inst->m_typRes.GetType()), pp);
|
||||
delete inst;
|
||||
return nullptr;
|
||||
}
|
||||
// put the result on the stack to have something
|
||||
if (inst->m_typRes.GetType() > 0)
|
||||
{
|
||||
CBotVar* pResult = CBotVar::Create("", inst->m_typRes);
|
||||
if (inst->m_typRes.Eq(CBotTypClass))
|
||||
{
|
||||
pResult->SetClass(inst->m_typRes.GetClass());
|
||||
}
|
||||
pStack->SetVar(pResult);
|
||||
}
|
||||
return inst;
|
||||
pStack->SetError(static_cast<CBotError>(inst->m_typRes.GetType()), pp);
|
||||
delete inst;
|
||||
return nullptr;
|
||||
}
|
||||
delete inst;
|
||||
return nullptr;
|
||||
// put the result on the stack to have something
|
||||
if (inst->m_typRes.GetType() > 0)
|
||||
{
|
||||
CBotVar* pResult = CBotVar::Create("", inst->m_typRes);
|
||||
if (inst->m_typRes.Eq(CBotTypClass))
|
||||
{
|
||||
pResult->SetClass(inst->m_typRes.GetClass());
|
||||
}
|
||||
pStack->SetVar(pResult);
|
||||
}
|
||||
return inst;
|
||||
}
|
||||
delete inst;
|
||||
return nullptr;
|
||||
}
|
||||
pStack->SetError(static_cast<CBotError>(1234), p); // TODO: seriously? ~krzys_h
|
||||
delete inst;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -282,7 +277,7 @@ std::string CBotInstrMethode::GetDebugData()
|
|||
std::stringstream ss;
|
||||
ss << m_methodName << std::endl;
|
||||
ss << "MethodID = " << m_MethodeIdent << std::endl;
|
||||
ss << "result = " << m_typRes.GetType(); // TODO: Type to string?
|
||||
ss << "result = " << m_typRes.ToString();
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,8 @@ bool CBotLeftExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevT
|
|||
pVar = pile->FindVar(m_nIdent, false);
|
||||
if (pVar == nullptr)
|
||||
{
|
||||
pile->SetError(static_cast<CBotError>(2), &m_token); // TODO: yup, another unknown error ~krzys_h
|
||||
assert(false);
|
||||
//pile->SetError(static_cast<CBotError>(2), &m_token); // TODO: yup, another unknown error ~krzys_h
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace CBot
|
|||
* a = 0
|
||||
* a = 0, int b = 3
|
||||
* a = 5, b = 7
|
||||
* int a = 3, b = 8 // TODO: does that compile into declaration of two variables or declaration and assignment?
|
||||
* int a = 3, b = 8 // This declares b as new variable, not assigns to it!
|
||||
* i++
|
||||
* i++, j++
|
||||
* int a = 5, j++
|
||||
|
|
|
@ -196,7 +196,7 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera
|
|||
type2 = pStk->GetTypResult(); // what kind of results?
|
||||
|
||||
// what kind of result?
|
||||
int TypeRes = std::max( type1.GetType(3), type2.GetType(3) );
|
||||
int TypeRes = std::max( type1.GetType(CBotTypResult::GetTypeMode::NULL_AS_POINTER), type2.GetType(CBotTypResult::GetTypeMode::NULL_AS_POINTER) );
|
||||
if ( TypeOp == ID_ADD && type1.Eq(CBotTypString) )
|
||||
{
|
||||
TypeRes = CBotTypString;
|
||||
|
|
|
@ -405,7 +405,7 @@ bool CBotStack::SetState(int n, int limite)
|
|||
{
|
||||
m_state = n;
|
||||
|
||||
m_timer--; // decrement the operations \TODO decrement the operations
|
||||
m_timer--; // decrement the timer
|
||||
return ( m_timer > limite ); // interrupted if timer pass
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,7 @@ bool CBotStack::IncState(int limite)
|
|||
{
|
||||
m_state++;
|
||||
|
||||
m_timer--; // decrement the operations \TODO decompte les operations
|
||||
m_timer--; // decrement the timer
|
||||
return ( m_timer > limite ); // interrupted if timer pass
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ bool CBotStack::Execute()
|
|||
|
||||
if ( instr == nullptr ) return true; // normal execution request
|
||||
|
||||
if (!instr->Run(nullptr, pile)) return false; // \TODO exécution à partir de là
|
||||
if (!instr->Run(nullptr, pile)) return false; // resume interrupted execution
|
||||
|
||||
pile->m_next->Delete();
|
||||
|
||||
|
@ -533,7 +533,7 @@ void CBotStack::AddVar(CBotVar* pVar)
|
|||
void CBotStack::SetProgram(CBotProgram* p)
|
||||
{
|
||||
m_prog = p;
|
||||
m_bFunc = IsFunction::TRUE;
|
||||
m_bFunc = IsFunction::YES;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -623,7 +623,7 @@ void CBotStack::GetRunPos(std::string& functionName, int& start, int& end)
|
|||
while (p->m_next != nullptr)
|
||||
{
|
||||
if ( p->m_instr != nullptr ) instr = p->m_instr;
|
||||
if ( p->m_bFunc == IsFunction::TRUE && p->m_instr != nullptr ) funct = p->m_instr;
|
||||
if ( p->m_bFunc == IsFunction::YES && p->m_instr != nullptr ) funct = p->m_instr;
|
||||
if ( p->m_next->m_prog != prog ) break ;
|
||||
|
||||
if (p->m_next2 && p->m_next2->m_state != 0) p = p->m_next2 ;
|
||||
|
@ -631,7 +631,7 @@ void CBotStack::GetRunPos(std::string& functionName, int& start, int& end)
|
|||
}
|
||||
|
||||
if ( p->m_instr != nullptr ) instr = p->m_instr;
|
||||
if ( p->m_bFunc == IsFunction::TRUE && p->m_instr != nullptr ) funct = p->m_instr;
|
||||
if ( p->m_bFunc == IsFunction::YES && p->m_instr != nullptr ) funct = p->m_instr;
|
||||
|
||||
if ( funct == nullptr ) return;
|
||||
|
||||
|
@ -681,7 +681,7 @@ CBotVar* CBotStack::GetStackVars(std::string& functionName, int level)
|
|||
CBotStack* pp = p;
|
||||
while ( pp != nullptr )
|
||||
{
|
||||
if ( pp->m_bFunc == IsFunction::TRUE) break;
|
||||
if ( pp->m_bFunc == IsFunction::YES) break;
|
||||
pp = pp->m_prev;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
FUNCTION = 2 //!< Function - variable visibility limit
|
||||
};
|
||||
|
||||
enum class IsFunction : unsigned short { NO = 0, TRUE = 1, EXTERNAL_CALL = 2 }; // TODO: just guessing the meaning of values, should be verified ~krzys_h
|
||||
enum class IsFunction : unsigned short { NO = 0, YES = 1, EXTERNAL_CALL = 2 };
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! \name Stack memory management
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "CBot/CBotClass.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
namespace CBot
|
||||
{
|
||||
|
@ -30,76 +32,76 @@ namespace CBot
|
|||
CBotTypResult::CBotTypResult(int type)
|
||||
{
|
||||
m_type = type;
|
||||
m_pNext = nullptr;
|
||||
m_pClass = nullptr;
|
||||
m_next = nullptr;
|
||||
m_class = nullptr;
|
||||
m_limite = -1;
|
||||
}
|
||||
|
||||
CBotTypResult::CBotTypResult(int type, const std::string& name)
|
||||
{
|
||||
m_type = type;
|
||||
m_pNext = nullptr;
|
||||
m_pClass = nullptr;
|
||||
m_next = nullptr;
|
||||
m_class = nullptr;
|
||||
m_limite = -1;
|
||||
|
||||
if ( type == CBotTypPointer ||
|
||||
type == CBotTypClass ||
|
||||
type == CBotTypIntrinsic )
|
||||
{
|
||||
m_pClass = CBotClass::Find(name);
|
||||
if ( m_pClass && m_pClass->IsIntrinsic() ) m_type = CBotTypIntrinsic;
|
||||
m_class = CBotClass::Find(name);
|
||||
if (m_class && m_class->IsIntrinsic() ) m_type = CBotTypIntrinsic;
|
||||
}
|
||||
}
|
||||
|
||||
CBotTypResult::CBotTypResult(int type, CBotClass* pClass)
|
||||
{
|
||||
m_type = type;
|
||||
m_pNext = nullptr;
|
||||
m_pClass = pClass;
|
||||
m_next = nullptr;
|
||||
m_class = pClass;
|
||||
m_limite = -1;
|
||||
|
||||
if ( m_pClass && m_pClass->IsIntrinsic() ) m_type = CBotTypIntrinsic;
|
||||
if (m_class && m_class->IsIntrinsic() ) m_type = CBotTypIntrinsic;
|
||||
}
|
||||
|
||||
CBotTypResult::CBotTypResult(int type, CBotTypResult elem)
|
||||
{
|
||||
m_type = type;
|
||||
m_pNext = nullptr;
|
||||
m_pClass = nullptr;
|
||||
m_next = nullptr;
|
||||
m_class = nullptr;
|
||||
m_limite = -1;
|
||||
|
||||
if ( type == CBotTypArrayPointer ||
|
||||
type == CBotTypArrayBody )
|
||||
m_pNext = new CBotTypResult( elem );
|
||||
m_next = new CBotTypResult(elem );
|
||||
}
|
||||
|
||||
CBotTypResult::CBotTypResult(const CBotTypResult& typ)
|
||||
{
|
||||
m_type = typ.m_type;
|
||||
m_pClass = typ.m_pClass;
|
||||
m_pNext = nullptr;
|
||||
m_class = typ.m_class;
|
||||
m_next = nullptr;
|
||||
m_limite = typ.m_limite;
|
||||
|
||||
if ( typ.m_pNext )
|
||||
m_pNext = new CBotTypResult( *typ.m_pNext );
|
||||
if ( typ.m_next)
|
||||
m_next = new CBotTypResult(*typ.m_next);
|
||||
}
|
||||
|
||||
CBotTypResult::CBotTypResult()
|
||||
{
|
||||
m_type = 0;
|
||||
m_limite = -1;
|
||||
m_pNext = nullptr;
|
||||
m_pClass = nullptr;
|
||||
m_next = nullptr;
|
||||
m_class = nullptr;
|
||||
}
|
||||
|
||||
CBotTypResult::~CBotTypResult()
|
||||
{
|
||||
delete m_pNext;
|
||||
delete m_next;
|
||||
}
|
||||
|
||||
int CBotTypResult::GetType(int mode) const
|
||||
int CBotTypResult::GetType(GetTypeMode mode) const
|
||||
{
|
||||
if ( mode == 3 && m_type == CBotTypNullPointer ) return CBotTypPointer;
|
||||
if ( mode == GetTypeMode::NULL_AS_POINTER && m_type == CBotTypNullPointer ) return CBotTypPointer;
|
||||
return m_type;
|
||||
}
|
||||
|
||||
|
@ -110,12 +112,12 @@ void CBotTypResult::SetType(int n)
|
|||
|
||||
CBotClass* CBotTypResult::GetClass() const
|
||||
{
|
||||
return m_pClass;
|
||||
return m_class;
|
||||
}
|
||||
|
||||
CBotTypResult& CBotTypResult::GetTypElem() const
|
||||
{
|
||||
return *m_pNext;
|
||||
return *m_next;
|
||||
}
|
||||
|
||||
int CBotTypResult::GetLimite() const
|
||||
|
@ -128,14 +130,14 @@ void CBotTypResult::SetLimite(int n)
|
|||
m_limite = n;
|
||||
}
|
||||
|
||||
void CBotTypResult::SetArray( int* max )
|
||||
void CBotTypResult::SetArray(int max[])
|
||||
{
|
||||
m_limite = *max;
|
||||
if (m_limite < 1) m_limite = -1;
|
||||
|
||||
if ( m_pNext != nullptr ) // last dimension?
|
||||
if (m_next != nullptr)
|
||||
{
|
||||
m_pNext->SetArray( max+1 );
|
||||
m_next->SetArray(max+1); // next element
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,13 +145,13 @@ bool CBotTypResult::Compare(const CBotTypResult& typ) const
|
|||
{
|
||||
if ( m_type != typ.m_type ) return false;
|
||||
|
||||
if ( m_type == CBotTypArrayPointer ) return m_pNext->Compare(*typ.m_pNext);
|
||||
if ( m_type == CBotTypArrayPointer ) return m_next->Compare(*typ.m_next);
|
||||
|
||||
if ( m_type == CBotTypPointer ||
|
||||
m_type == CBotTypClass ||
|
||||
m_type == CBotTypIntrinsic )
|
||||
{
|
||||
return m_pClass == typ.m_pClass;
|
||||
return m_class == typ.m_class;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -164,11 +166,11 @@ CBotTypResult& CBotTypResult::operator=(const CBotTypResult& src)
|
|||
{
|
||||
m_type = src.m_type;
|
||||
m_limite = src.m_limite;
|
||||
m_pClass = src.m_pClass;
|
||||
m_pNext = nullptr;
|
||||
if ( src.m_pNext != nullptr )
|
||||
m_class = src.m_class;
|
||||
m_next = nullptr;
|
||||
if (src.m_next != nullptr )
|
||||
{
|
||||
m_pNext = new CBotTypResult(*src.m_pNext);
|
||||
m_next = new CBotTypResult(*src.m_next);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -182,14 +184,16 @@ std::string CBotTypResult::ToString()
|
|||
case CBotTypFloat: return "float";
|
||||
case CBotTypBoolean: return "bool";
|
||||
case CBotTypString: return "string";
|
||||
case CBotTypArrayPointer: return m_pNext->ToString()+"[]";
|
||||
case CBotTypArrayBody: return m_pNext->ToString()+"[] (by value)";
|
||||
case CBotTypPointer: return m_pClass->GetName();
|
||||
case CBotTypNullPointer: return m_pClass->GetName()+" (null)";
|
||||
case CBotTypClass: return m_pClass->GetName()+" (by value)";
|
||||
case CBotTypIntrinsic: return m_pClass->GetName()+" (intr)";
|
||||
case CBotTypArrayPointer: return m_next->ToString() + "[]";
|
||||
case CBotTypArrayBody: return m_next->ToString() + "[] (by value)";
|
||||
case CBotTypPointer: return m_class->GetName();
|
||||
case CBotTypNullPointer: return m_class->GetName() + " (null)";
|
||||
case CBotTypClass: return m_class->GetName() + " (by value)";
|
||||
case CBotTypIntrinsic: return m_class->GetName() + " (intr)";
|
||||
}
|
||||
return "?";
|
||||
std::stringstream ss;
|
||||
ss << "UNKNOWN" << m_type;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
} // namespace CBot
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "CBot/CBotEnums.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace CBot
|
||||
|
@ -94,10 +96,19 @@ public:
|
|||
~CBotTypResult();
|
||||
|
||||
/**
|
||||
* \brief Returns ::CBotType or ::CBotError stored in this object
|
||||
* \param mode TODO: document this
|
||||
* \brief Mode for GetType() and GetTypResult()
|
||||
*/
|
||||
int GetType(int mode = 0) const;
|
||||
enum class GetTypeMode
|
||||
{
|
||||
NORMAL = 0,
|
||||
NULL_AS_POINTER = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns ::CBotType or ::CBotError stored in this object
|
||||
* \param mode Mode, see ::GetTypeMode enum
|
||||
*/
|
||||
int GetType(GetTypeMode mode = GetTypeMode::NORMAL) const;
|
||||
|
||||
/**
|
||||
* \brief Changes ::CBotType or ::CBotError stored in this object
|
||||
|
@ -108,12 +119,12 @@ public:
|
|||
/**
|
||||
* \brief Returns CBotClass pointer (for ::CBotTypClass, ::CBotTypPointer)
|
||||
*/
|
||||
CBotClass* GetClass() const;
|
||||
CBotClass* GetClass() const;
|
||||
|
||||
/**
|
||||
* \brief Get size limit of an array (for ::CBotTypArrayBody or ::CBotTypArrayPointer)
|
||||
*/
|
||||
int GetLimite() const;
|
||||
int GetLimite() const;
|
||||
|
||||
/**
|
||||
* \brief Set size limit of an array (for ::CBotTypArrayBody or ::CBotTypArrayPointer)
|
||||
|
@ -123,9 +134,9 @@ public:
|
|||
|
||||
/**
|
||||
* \brief Set size limit of an multidimensional array
|
||||
* \param max TODO: document this
|
||||
* \param max Array of limit values, the array size has to match the number of dimensions of this array
|
||||
*/
|
||||
void SetArray(int* max);
|
||||
void SetArray(int max[]);
|
||||
|
||||
/**
|
||||
* \brief Get type of array elements (for ::CBotTypArrayBody or ::CBotTypArrayPointer)
|
||||
|
@ -148,16 +159,20 @@ public:
|
|||
bool Eq(int type) const;
|
||||
|
||||
/**
|
||||
* Copy
|
||||
* \brief Copy
|
||||
*/
|
||||
CBotTypResult& operator=(const CBotTypResult& src);
|
||||
|
||||
/**
|
||||
* \brief Get this type name as string
|
||||
* \returns This type name as string
|
||||
*/
|
||||
std::string ToString();
|
||||
|
||||
private:
|
||||
int m_type; //!< type, see ::CBotType and ::CBotError
|
||||
CBotTypResult* m_pNext; //!< type of array element
|
||||
CBotClass* m_pClass; //!< class type
|
||||
CBotTypResult* m_next; //!< type of array element
|
||||
CBotClass* m_class; //!< class type
|
||||
int m_limite; //!< array limit
|
||||
friend class CBotVarClass;
|
||||
friend class CBotVarPointer;
|
||||
|
|
|
@ -198,7 +198,6 @@ public:
|
|||
|
||||
/**
|
||||
* \brief Returns the complete type of the variable (CBotTypResult)
|
||||
* \param mode
|
||||
* \param mode Mode, see GetTypeMode enum
|
||||
*/
|
||||
CBotTypResult GetTypResult(GetTypeMode mode = GetTypeMode::NORMAL);
|
||||
|
@ -355,8 +354,8 @@ public:
|
|||
virtual void ConstructorSet();
|
||||
|
||||
/**
|
||||
* \brief TODO: document, original description: Makes the pointer to the variable if it is static.
|
||||
* \return
|
||||
* \brief If this is a static class variable, return the static var from the class
|
||||
* \return Static variable from CBotClass instance if this variable is static, or this otherwise
|
||||
*/
|
||||
CBotVar* GetStaticVar();
|
||||
|
||||
|
@ -370,19 +369,23 @@ public:
|
|||
|
||||
/**
|
||||
* \brief Set unique identifier of this variable
|
||||
* Note: For classes, this is unique within the class only - see CBotClass:AddItem
|
||||
* \param n New identifier
|
||||
*/
|
||||
void SetUniqNum(long n);
|
||||
|
||||
/**
|
||||
* \brief Return unique identifier of this variable
|
||||
* \return Identifier
|
||||
* Note: For classes, this is unique within the class only - see CBotClass:AddItem
|
||||
* \return unique identifier
|
||||
* \see SetUniqNum()
|
||||
*/
|
||||
long GetUniqNum();
|
||||
|
||||
/**
|
||||
* \brief TODO: ?
|
||||
* \brief Generate next unique identifier
|
||||
*
|
||||
* Used by both variables (CBotVar) and functions (CBotFunction)
|
||||
*/
|
||||
static long NextUniqNum();
|
||||
|
||||
|
|
|
@ -65,9 +65,8 @@ CBotVarClass::CBotVarClass(const CBotToken& name, const CBotTypResult& type)
|
|||
m_CptUse = 0;
|
||||
m_ItemIdent = type.Eq(CBotTypIntrinsic) ? 0 : CBotVar::NextUniqNum();
|
||||
|
||||
// se place tout seul dans la liste
|
||||
// TODO stands alone in the list (stands only in a list)
|
||||
if (m_ExClass) m_ExClass->m_ExPrev = this;
|
||||
// add to the list
|
||||
if (m_ExClass != nullptr) m_ExClass->m_ExPrev = this;
|
||||
m_ExNext = m_ExClass;
|
||||
m_ExPrev = nullptr;
|
||||
m_ExClass = this;
|
||||
|
@ -167,7 +166,7 @@ void CBotVarClass::SetIdent(long n)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CBotVarClass::SetClass(CBotClass* pClass)//, int &nIdent)
|
||||
{
|
||||
m_type.m_pClass = pClass;
|
||||
m_type.m_class = pClass;
|
||||
|
||||
if ( m_pClass == pClass ) return;
|
||||
|
||||
|
@ -200,7 +199,7 @@ void CBotVarClass::SetClass(CBotClass* pClass)//, int &nIdent)
|
|||
}
|
||||
while (n<100) max[n++] = 0;
|
||||
|
||||
pv->m_type.SetArray( max ); // stores the limitations
|
||||
pv->m_type.SetArray(max); // stores the limitations
|
||||
pile->Delete();
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ long CBotVarPointer::GetIdent()
|
|||
void CBotVarPointer::SetClass(CBotClass* pClass)
|
||||
{
|
||||
// int nIdent = 0;
|
||||
m_type.m_pClass = m_pClass = pClass;
|
||||
m_type.m_class = m_pClass = pClass;
|
||||
if ( m_pVarClass != nullptr ) m_pVarClass->SetClass(pClass); //, nIdent);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,6 @@ public:
|
|||
|
||||
virtual std::string ReadLine() = 0;
|
||||
virtual void Write(const std::string& s) = 0;
|
||||
|
||||
//TODO
|
||||
};
|
||||
|
||||
class CBotFileAccessHandler
|
||||
|
|
Loading…
Reference in New Issue