Fixed crash from previous commit (oops again)
parent
8fa5b208c2
commit
30fea5893b
|
@ -683,7 +683,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
|
|||
|
||||
// make "this" known
|
||||
CBotToken TokenThis(std::string("this"), std::string());
|
||||
CBotVar* pThis = CBotVar::Create(&TokenThis, CBotTypResult( CBotTypClass, this ) );
|
||||
CBotVar* pThis = CBotVar::Create(TokenThis, CBotTypResult( CBotTypClass, this ) );
|
||||
pThis->SetUniqNum(-2);
|
||||
pile->AddVar(pThis);
|
||||
|
||||
|
@ -691,7 +691,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
|
|||
{
|
||||
// makes "super" known
|
||||
CBotToken TokenSuper(std::string("super"), std::string());
|
||||
CBotVar* pThis = CBotVar::Create(&TokenSuper, CBotTypResult( CBotTypClass, m_pParent ) );
|
||||
CBotVar* pThis = CBotVar::Create(TokenSuper, CBotTypResult( CBotTypClass, m_pParent ) );
|
||||
pThis->SetUniqNum(-3);
|
||||
pile->AddVar(pThis);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
|
|||
}
|
||||
}
|
||||
|
||||
var = CBotVar::Create(vartoken, CBotTypBoolean);// create the variable (evaluated after the assignment)
|
||||
var = CBotVar::Create(*vartoken, CBotTypBoolean);// create the variable (evaluated after the assignment)
|
||||
var->SetInit(inst->m_expr != nullptr ? CBotVar::InitType::DEF : CBotVar::InitType::UNDEF);
|
||||
var->SetUniqNum(
|
||||
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
|
||||
|
|
|
@ -105,7 +105,7 @@ bool CBotCatch :: TestCatch(CBotStack* &pile, int val)
|
|||
|
||||
if ( val > 0 || pile->GetType() != CBotTypBoolean )
|
||||
{
|
||||
CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypBoolean);
|
||||
CBotVar* var = CBotVar::Create("", CBotTypBoolean);
|
||||
var->SetValInt( pile->GetVal() == val );
|
||||
pile->SetVar(var); // calls on the stack
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ CBotInstr* CBotExprAlpha::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
inst->SetToken(p);
|
||||
p = p->GetNext();
|
||||
|
||||
CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypString);
|
||||
CBotVar* var = CBotVar::Create("", CBotTypString);
|
||||
pStk->SetVar(var);
|
||||
|
||||
return pStack->Return(inst, pStk);
|
||||
|
@ -63,7 +63,7 @@ bool CBotExprAlpha::Execute(CBotStack* &pj)
|
|||
|
||||
if (pile->IfStep()) return false;
|
||||
|
||||
CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypString);
|
||||
CBotVar* var = CBotVar::Create("", CBotTypString);
|
||||
|
||||
std::string chaine = m_token.GetString();
|
||||
chaine = chaine.substr(1, chaine.length()-2); // removes the quotes
|
||||
|
|
|
@ -54,7 +54,7 @@ CBotInstr* CBotExprBool::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
inst->SetToken(p); // stores the operation false or true
|
||||
p = p->GetNext();
|
||||
|
||||
CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypBoolean);
|
||||
CBotVar* var = CBotVar::Create("", CBotTypBoolean);
|
||||
pStk->SetVar(var);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ bool CBotExprBool::Execute(CBotStack* &pj)
|
|||
|
||||
if (pile->IfStep()) return false;
|
||||
|
||||
CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypBoolean);
|
||||
CBotVar* var = CBotVar::Create("", CBotTypBoolean);
|
||||
|
||||
if (GetTokenType() == ID_TRUE) var->SetValInt(1);
|
||||
else var->SetValInt(0);
|
||||
|
|
|
@ -45,7 +45,7 @@ bool CBotExprNan::Execute(CBotStack* &pj)
|
|||
CBotStack* pile = pj->AddStack(this);
|
||||
|
||||
if (pile->IfStep()) return false;
|
||||
CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypInt);
|
||||
CBotVar* var = CBotVar::Create("", CBotTypInt);
|
||||
|
||||
var->SetInit(CBotVar::InitType::IS_NAN); // nan
|
||||
pile->SetVar(var); // put on the stack
|
||||
|
|
|
@ -46,7 +46,7 @@ bool CBotExprNull::Execute(CBotStack* &pj)
|
|||
CBotStack* pile = pj->AddStack(this);
|
||||
|
||||
if (pile->IfStep()) return false;
|
||||
CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypNullPointer);
|
||||
CBotVar* var = CBotVar::Create("", CBotTypNullPointer);
|
||||
|
||||
var->SetInit(CBotVar::InitType::DEF); // null pointer valid
|
||||
pile->SetVar(var); // place on the stack
|
||||
|
|
|
@ -72,7 +72,7 @@ CBotInstr* CBotExprNum::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
|
||||
if (pStk->NextToken(p))
|
||||
{
|
||||
CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), inst->m_numtype);
|
||||
CBotVar* var = CBotVar::Create("", inst->m_numtype);
|
||||
pStk->SetVar(var);
|
||||
|
||||
return pStack->Return(inst, pStk);
|
||||
|
@ -88,7 +88,7 @@ bool CBotExprNum::Execute(CBotStack* &pj)
|
|||
|
||||
if (pile->IfStep()) return false;
|
||||
|
||||
CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), m_numtype);
|
||||
CBotVar* var = CBotVar::Create("", m_numtype);
|
||||
|
||||
std::string nombre ;
|
||||
if (m_token.GetType() == TokenTypDef)
|
||||
|
|
|
@ -105,7 +105,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool
|
|||
}
|
||||
}
|
||||
|
||||
var = CBotVar::Create(vartoken, CBotTypFloat);
|
||||
var = CBotVar::Create(*vartoken, CBotTypFloat);
|
||||
var->SetInit(inst->m_expr != nullptr ? CBotVar::InitType::DEF : CBotVar::InitType::UNDEF);
|
||||
var->SetUniqNum(
|
||||
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
|
||||
|
|
|
@ -236,7 +236,7 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
|
|||
// and compiles the following instruction block
|
||||
func->m_openblk = *p;
|
||||
func->m_Block = CBotBlock::Compile(p, pStk, false);
|
||||
func->m_closeblk = *(p->GetPrev());
|
||||
func->m_closeblk = p->GetPrev() != nullptr ? *(p->GetPrev()) : CBotToken();
|
||||
if ( pStk->IsOk() )
|
||||
{
|
||||
if ( func->m_bPublic ) // public function, return known for all
|
||||
|
|
|
@ -89,7 +89,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
|
|||
}*/
|
||||
}
|
||||
|
||||
CBotVar* var = CBotVar::Create(vartoken, CBotTypString);
|
||||
CBotVar* var = CBotVar::Create(*vartoken, CBotTypString);
|
||||
var->SetInit(inst->m_expr != nullptr ? CBotVar::InitType::DEF : CBotVar::InitType::UNDEF);
|
||||
var->SetUniqNum(
|
||||
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
|
||||
|
|
|
@ -89,7 +89,7 @@ CBotInstr* CBotInstArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu
|
|||
}
|
||||
}
|
||||
|
||||
CBotVar* var = CBotVar::Create(vartoken, type); // create an instance
|
||||
CBotVar* var = CBotVar::Create(*vartoken, type); // create an instance
|
||||
inst->m_typevar = type;
|
||||
|
||||
var->SetUniqNum(
|
||||
|
@ -157,7 +157,7 @@ bool CBotInstArray::Execute(CBotStack* &pj)
|
|||
m_typevar.SetArray(max); // store the limitations
|
||||
|
||||
// create simply a nullptr pointer
|
||||
CBotVar* var = CBotVar::Create(m_var->GetToken(), m_typevar);
|
||||
CBotVar* var = CBotVar::Create(*(m_var->GetToken()), m_typevar);
|
||||
var->SetPointer(nullptr);
|
||||
var->SetUniqNum((static_cast<CBotLeftExprVar*>(m_var))->m_nIdent);
|
||||
pj->AddVar(var);
|
||||
|
|
|
@ -119,7 +119,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
|
|||
}
|
||||
|
||||
{
|
||||
CBotVar* var = CBotVar::Create(vartoken, CBotTypInt);// create the variable (evaluated after the assignment)
|
||||
CBotVar* var = CBotVar::Create(*vartoken, CBotTypInt);// create the variable (evaluated after the assignment)
|
||||
var->SetInit(inst->m_expr != nullptr ? CBotVar::InitType::DEF : CBotVar::InitType::UNDEF); // if initialized with assignment
|
||||
var->SetUniqNum( //set it with a unique number
|
||||
(static_cast<CBotLeftExprVar*>(inst->m_var))->m_nIdent = CBotVar::NextUniqNum());
|
||||
|
|
|
@ -260,7 +260,7 @@ CBotInstr* CBotTwoOpExpr::Compile(CBotToken* &p, CBotCStack* pStack, int* pOpera
|
|||
CBotTypResult t(type1);
|
||||
t.SetType(TypeRes);
|
||||
// is a variable on the stack for the type of result
|
||||
pStk->SetVar(CBotVar::Create(static_cast<CBotToken*>(nullptr), t));
|
||||
pStk->SetVar(CBotVar::Create("", t));
|
||||
|
||||
// and returns the requested object
|
||||
return pStack->Return(inst, pStk);
|
||||
|
@ -313,14 +313,14 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
|
|||
// for OR and AND logic does not evaluate the second expression if not necessary
|
||||
if ( (GetTokenType() == ID_LOG_AND || GetTokenType() == ID_TXT_AND ) && pStk1->GetVal() == false )
|
||||
{
|
||||
CBotVar* res = CBotVar::Create( static_cast<CBotToken*>(nullptr), CBotTypBoolean);
|
||||
CBotVar* res = CBotVar::Create("", CBotTypBoolean);
|
||||
res->SetValInt(false);
|
||||
pStk1->SetVar(res);
|
||||
return pStack->Return(pStk1); // transmits the result
|
||||
}
|
||||
if ( (GetTokenType() == ID_LOG_OR||GetTokenType() == ID_TXT_OR) && pStk1->GetVal() == true )
|
||||
{
|
||||
CBotVar* res = CBotVar::Create( static_cast<CBotToken*>(nullptr), CBotTypBoolean);
|
||||
CBotVar* res = CBotVar::Create("", CBotTypBoolean);
|
||||
res->SetValInt(true);
|
||||
pStk1->SetVar(res);
|
||||
return pStack->Return(pStk1); // transmits the result
|
||||
|
@ -378,7 +378,7 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
|
|||
}
|
||||
|
||||
// creates a variable for the result
|
||||
CBotVar* result = CBotVar::Create( static_cast<CBotToken*>(nullptr), TypeRes);
|
||||
CBotVar* result = CBotVar::Create("", TypeRes);
|
||||
|
||||
// creates a variable to perform the calculation in the appropriate type
|
||||
TypeRes = MAX(type1.GetType(), type2.GetType());
|
||||
|
@ -391,8 +391,8 @@ bool CBotTwoOpExpr::Execute(CBotStack* &pStack)
|
|||
CBotVar* temp;
|
||||
|
||||
if ( TypeRes == CBotTypPointer ) TypeRes = CBotTypNullPointer;
|
||||
if ( TypeRes == CBotTypClass ) temp = CBotVar::Create( static_cast<CBotToken*>(nullptr), CBotTypResult(CBotTypIntrinsic, type1.GetClass() ) );
|
||||
else temp = CBotVar::Create( static_cast<CBotToken*>(nullptr), TypeRes );
|
||||
if ( TypeRes == CBotTypClass ) temp = CBotVar::Create("", CBotTypResult(CBotTypIntrinsic, type1.GetClass() ) );
|
||||
else temp = CBotVar::Create("", TypeRes );
|
||||
|
||||
CBotError err = CBotNoErr;
|
||||
// is a operation according to request
|
||||
|
|
|
@ -1021,17 +1021,17 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
|
|||
{
|
||||
case CBotTypInt:
|
||||
case CBotTypBoolean:
|
||||
pNew = CBotVar::Create(&token, w); // creates a variable
|
||||
pNew = CBotVar::Create(token, w); // creates a variable
|
||||
if (!ReadWord(pf, w)) return false;
|
||||
pNew->SetValInt(static_cast<short>(w), defnum);
|
||||
break;
|
||||
case CBotTypFloat:
|
||||
pNew = CBotVar::Create(&token, w); // creates a variable
|
||||
pNew = CBotVar::Create(token, w); // creates a variable
|
||||
if (!ReadFloat(pf, ww)) return false;
|
||||
pNew->SetValFloat(ww);
|
||||
break;
|
||||
case CBotTypString:
|
||||
pNew = CBotVar::Create(&token, w); // creates a variable
|
||||
pNew = CBotVar::Create(token, w); // creates a variable
|
||||
if (!ReadString(pf, s)) return false;
|
||||
pNew->SetValString(s);
|
||||
break;
|
||||
|
@ -1050,7 +1050,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
|
|||
CBotVar* p = nullptr;
|
||||
if ( id ) p = CBotVarClass::Find(id) ;
|
||||
|
||||
pNew = new CBotVarClass(&token, r); // directly creates an instance
|
||||
pNew = new CBotVarClass(token, r); // directly creates an instance
|
||||
// attention cptuse = 0
|
||||
if ( !RestoreState(pf, (static_cast<CBotVarClass*>(pNew))->m_pVar)) return false;
|
||||
pNew->SetIdent(id);
|
||||
|
@ -1068,7 +1068,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
|
|||
case CBotTypNullPointer:
|
||||
if (!ReadString(pf, s)) return false;
|
||||
{
|
||||
pNew = CBotVar::Create(&token, CBotTypResult(w, s));// creates a variable
|
||||
pNew = CBotVar::Create(token, CBotTypResult(w, s));// creates a variable
|
||||
// CBotVarClass* p = nullptr;
|
||||
long id;
|
||||
ReadLong(pf, id);
|
||||
|
@ -1089,7 +1089,7 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
|
|||
CBotTypResult r;
|
||||
if (!ReadType(pf, r)) return false;
|
||||
|
||||
pNew = CBotVar::Create(&token, r); // creates a variable
|
||||
pNew = CBotVar::Create(token, r); // creates a variable
|
||||
|
||||
// returns a copy of the original instance
|
||||
CBotVar* pInstance = nullptr;
|
||||
|
|
|
@ -186,12 +186,16 @@ void CBotToken::ClearDefineNum()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
const CBotToken& CBotToken::operator=(const CBotToken& src)
|
||||
{
|
||||
delete m_next;
|
||||
m_next = nullptr;
|
||||
m_prev = nullptr;
|
||||
assert(m_prev == nullptr);
|
||||
if (m_next != nullptr)
|
||||
{
|
||||
m_next->m_prev = nullptr;
|
||||
delete m_next;
|
||||
m_next = nullptr;
|
||||
}
|
||||
|
||||
m_text = src.m_text;
|
||||
m_sep = src.m_sep;
|
||||
m_text = src.m_text;
|
||||
m_sep = src.m_sep;
|
||||
|
||||
m_type = src.m_type;
|
||||
m_keywordId = src.m_keywordId;
|
||||
|
|
|
@ -137,14 +137,14 @@ void CBotVar::Maj(void* pUser, bool bContinu)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CBotVar* CBotVar::Create(const CBotToken* name, CBotType type )
|
||||
CBotVar* CBotVar::Create(const CBotToken& name, CBotType type)
|
||||
{
|
||||
CBotTypResult t(type);
|
||||
return Create(name, t);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CBotVar* CBotVar::Create(const CBotToken* name, CBotTypResult type)
|
||||
CBotVar* CBotVar::Create(const CBotToken& name, CBotTypResult type)
|
||||
{
|
||||
switch (type.GetType())
|
||||
{
|
||||
|
@ -213,23 +213,23 @@ CBotVar* CBotVar::Create(const std::string& n, CBotTypResult type)
|
|||
{
|
||||
case CBotTypShort:
|
||||
case CBotTypInt:
|
||||
return new CBotVarInt(&name);
|
||||
return new CBotVarInt(name);
|
||||
case CBotTypFloat:
|
||||
return new CBotVarFloat(&name);
|
||||
return new CBotVarFloat(name);
|
||||
case CBotTypBoolean:
|
||||
return new CBotVarBoolean(&name);
|
||||
return new CBotVarBoolean(name);
|
||||
case CBotTypString:
|
||||
return new CBotVarString(&name);
|
||||
return new CBotVarString(name);
|
||||
case CBotTypPointer:
|
||||
case CBotTypNullPointer:
|
||||
{
|
||||
CBotVarPointer* p = new CBotVarPointer(&name, type);
|
||||
CBotVarPointer* p = new CBotVarPointer(name, type);
|
||||
// p->SetClass(type.GetClass());
|
||||
return p;
|
||||
}
|
||||
case CBotTypIntrinsic:
|
||||
{
|
||||
CBotVarClass* p = new CBotVarClass(&name, type);
|
||||
CBotVarClass* p = new CBotVarClass(name, type);
|
||||
// p->SetClass(type.GetClass());
|
||||
return p;
|
||||
}
|
||||
|
@ -238,20 +238,20 @@ CBotVar* CBotVar::Create(const std::string& n, CBotTypResult type)
|
|||
// creates a new instance of a class
|
||||
// and returns the POINTER on this instance
|
||||
{
|
||||
CBotVarClass* instance = new CBotVarClass(&name, type);
|
||||
CBotVarPointer* pointer = new CBotVarPointer(&name, type);
|
||||
CBotVarClass* instance = new CBotVarClass(name, type);
|
||||
CBotVarPointer* pointer = new CBotVarPointer(name, type);
|
||||
pointer->SetPointer( instance );
|
||||
// pointer->SetClass( type.GetClass() );
|
||||
return pointer;
|
||||
}
|
||||
|
||||
case CBotTypArrayPointer:
|
||||
return new CBotVarArray(&name, type);
|
||||
return new CBotVarArray(name, type);
|
||||
|
||||
case CBotTypArrayBody:
|
||||
{
|
||||
CBotVarClass* instance = new CBotVarClass(&name, type);
|
||||
CBotVarArray* array = new CBotVarArray(&name, type);
|
||||
CBotVarClass* instance = new CBotVarClass(name, type);
|
||||
CBotVarArray* array = new CBotVarArray(name, type);
|
||||
array->SetPointer( instance );
|
||||
|
||||
CBotVar* pv = array;
|
||||
|
@ -273,7 +273,7 @@ CBotVar* CBotVar::Create(const std::string& n, CBotTypResult type)
|
|||
CBotVar* CBotVar::Create(const std::string& name, CBotType type, CBotClass* pClass)
|
||||
{
|
||||
CBotToken token( name, "" );
|
||||
CBotVar* pVar = Create( &token, type );
|
||||
CBotVar* pVar = Create( token, type );
|
||||
|
||||
if ( type == CBotTypPointer && pClass == nullptr ) // pointer "null" ?
|
||||
return pVar;
|
||||
|
@ -295,7 +295,7 @@ CBotVar* CBotVar::Create(const std::string& name, CBotType type, CBotClass* pCla
|
|||
CBotVar* CBotVar::Create(const std::string& name, CBotClass* pClass)
|
||||
{
|
||||
CBotToken token( name, "" );
|
||||
CBotVar* pVar = Create( &token, CBotTypResult( CBotTypClass, pClass ) );
|
||||
CBotVar* pVar = Create( token, CBotTypResult( CBotTypClass, pClass ) );
|
||||
// pVar->SetClass( pClass );
|
||||
return pVar;
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ void CBotVar::SetInit(CBotVar::InitType initType)
|
|||
CBotVarClass* instance = GetPointer();
|
||||
if ( instance == nullptr )
|
||||
{
|
||||
instance = new CBotVarClass(nullptr, m_type);
|
||||
instance = new CBotVarClass(CBotToken(), m_type);
|
||||
// instance->SetClass((static_cast<CBotVarPointer*>(this))->m_classes);
|
||||
SetPointer(instance);
|
||||
}
|
||||
|
|
|
@ -82,14 +82,14 @@ public:
|
|||
* \param name Variable name token
|
||||
* \param type Variable type
|
||||
*/
|
||||
static CBotVar* Create(const CBotToken* name, CBotType type);
|
||||
static CBotVar* Create(const CBotToken& name, CBotType type);
|
||||
|
||||
/**
|
||||
* \brief Create a new variable of a given type described by CBotTypResult
|
||||
* \param name Variable name token
|
||||
* \param type Variable type
|
||||
*/
|
||||
static CBotVar* Create(const CBotToken* name, CBotTypResult type);
|
||||
static CBotVar* Create(const CBotToken& name, CBotTypResult type);
|
||||
|
||||
/**
|
||||
* \brief Create a new variable of a given type of given class instance
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
#include <cassert>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CBotVarArray::CBotVarArray(const CBotToken* name, CBotTypResult& type )
|
||||
CBotVarArray::CBotVarArray(const CBotToken& name, CBotTypResult& type)
|
||||
{
|
||||
if ( !type.Eq(CBotTypArrayPointer) &&
|
||||
!type.Eq(CBotTypArrayBody)) assert(0);
|
||||
|
||||
m_token = new CBotToken(*name);
|
||||
m_token = new CBotToken(name);
|
||||
m_next = nullptr;
|
||||
m_pMyThis = nullptr;
|
||||
m_pUserPtr = nullptr;
|
||||
|
@ -117,7 +117,7 @@ CBotVar* CBotVarArray::GetItem(int n, bool bExtend)
|
|||
if ( !bExtend ) return nullptr;
|
||||
// creates an instance of the table
|
||||
|
||||
CBotVarClass* instance = new CBotVarClass(nullptr, m_type);
|
||||
CBotVarClass* instance = new CBotVarClass(CBotToken(), m_type);
|
||||
SetPointer( instance );
|
||||
}
|
||||
return m_pInstance->GetItem(n, bExtend);
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
/**
|
||||
* \brief Constructor. Do not call directly, use CBotVar::Create()
|
||||
*/
|
||||
CBotVarArray(const CBotToken* name, CBotTypResult& type);
|
||||
CBotVarArray(const CBotToken& name, CBotTypResult& type);
|
||||
/**
|
||||
* \brief Destructor. Do not call directly, use CBotVar::Destroy()
|
||||
*/
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CBotVarBoolean::CBotVarBoolean( const CBotToken* name )
|
||||
CBotVarBoolean::CBotVarBoolean(const CBotToken& name)
|
||||
{
|
||||
m_token = new CBotToken(*name);
|
||||
m_token = new CBotToken(name);
|
||||
m_next = nullptr;
|
||||
m_pMyThis = nullptr;
|
||||
m_pUserPtr = nullptr;
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
/**
|
||||
* \brief Constructor. Do not call directly, use CBotVar::Create()
|
||||
*/
|
||||
CBotVarBoolean(const CBotToken* name);
|
||||
CBotVarBoolean(const CBotToken& name);
|
||||
|
||||
void SetValInt(int val, const std::string& s = nullptr) override;
|
||||
void SetValFloat(float val) override;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
CBotVarClass* CBotVarClass::m_ExClass = nullptr;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CBotVarClass::CBotVarClass( const CBotToken* name, const CBotTypResult& type)
|
||||
CBotVarClass::CBotVarClass(const CBotToken& name, const CBotTypResult& type)
|
||||
{
|
||||
if ( !type.Eq(CBotTypClass) &&
|
||||
!type.Eq(CBotTypIntrinsic) && // by convenience there accepts these types
|
||||
|
@ -45,7 +45,7 @@ CBotVarClass::CBotVarClass( const CBotToken* name, const CBotTypResult& type)
|
|||
!type.Eq(CBotTypArrayPointer) &&
|
||||
!type.Eq(CBotTypArrayBody)) assert(0);
|
||||
|
||||
m_token = new CBotToken(*name);
|
||||
m_token = new CBotToken(name);
|
||||
m_next = nullptr;
|
||||
m_pMyThis = nullptr;
|
||||
m_pUserPtr = OBJECTCREATED;//nullptr;
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
/**
|
||||
* \brief Constructor. Do not call directly, use CBotVar::Create()
|
||||
*/
|
||||
CBotVarClass(const CBotToken* name, const CBotTypResult& type);
|
||||
CBotVarClass(const CBotToken& name, const CBotTypResult& type);
|
||||
/**
|
||||
* \brief Destructor. Do not call directly, use CBotVar::Destroy()
|
||||
*/
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
#include <cmath>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CBotVarFloat::CBotVarFloat( const CBotToken* name )
|
||||
CBotVarFloat::CBotVarFloat(const CBotToken& name)
|
||||
{
|
||||
m_token = new CBotToken(*name);
|
||||
m_token = new CBotToken(name);
|
||||
m_next = nullptr;
|
||||
m_pMyThis = nullptr;
|
||||
m_pUserPtr = nullptr;
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
/**
|
||||
* \brief Constructor. Do not call directly, use CBotVar::Create()
|
||||
*/
|
||||
CBotVarFloat(const CBotToken* name);
|
||||
CBotVarFloat(const CBotToken& name);
|
||||
|
||||
void SetValInt(int val, const std::string& s = nullptr) override;
|
||||
void SetValFloat(float val) override;
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
#include <cmath>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CBotVarInt::CBotVarInt( const CBotToken* name )
|
||||
CBotVarInt::CBotVarInt(const CBotToken& name)
|
||||
{
|
||||
m_token = new CBotToken(*name);
|
||||
m_token = new CBotToken(name);
|
||||
m_next = nullptr;
|
||||
m_pMyThis = nullptr;
|
||||
m_pUserPtr = nullptr;
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
/**
|
||||
* \brief Constructor. Do not call directly, use CBotVar::Create()
|
||||
*/
|
||||
CBotVarInt(const CBotToken* name);
|
||||
CBotVarInt(const CBotToken& name);
|
||||
|
||||
void SetValInt(int val, const std::string& s = "") override;
|
||||
void SetValFloat(float val) override;
|
||||
|
|
|
@ -33,14 +33,14 @@
|
|||
#include <cassert>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CBotVarPointer::CBotVarPointer(const CBotToken* name, CBotTypResult& type )
|
||||
CBotVarPointer::CBotVarPointer(const CBotToken& name, CBotTypResult& type)
|
||||
{
|
||||
if ( !type.Eq(CBotTypPointer) &&
|
||||
!type.Eq(CBotTypNullPointer) &&
|
||||
!type.Eq(CBotTypClass) && // for convenience accepts Class and Intrinsic
|
||||
!type.Eq(CBotTypIntrinsic) ) assert(0);
|
||||
|
||||
m_token = new CBotToken(*name);
|
||||
m_token = new CBotToken(name);
|
||||
m_next = nullptr;
|
||||
m_pMyThis = nullptr;
|
||||
m_pUserPtr = nullptr;
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
/**
|
||||
* \brief Constructor. Do not call directly, use CBotVar::Create()
|
||||
*/
|
||||
CBotVarPointer(const CBotToken* name, CBotTypResult& type);
|
||||
CBotVarPointer(const CBotToken& name, CBotTypResult& type);
|
||||
/**
|
||||
* \brief Destructor. Do not call directly, use CBotVar::Destroy()
|
||||
*/
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
// Global include
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CBotVarString::CBotVarString( const CBotToken* name )
|
||||
CBotVarString::CBotVarString(const CBotToken& name)
|
||||
{
|
||||
m_token = new CBotToken(*name);
|
||||
m_token = new CBotToken(name);
|
||||
m_next = nullptr;
|
||||
m_pMyThis = nullptr;
|
||||
m_pUserPtr = nullptr;
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
/**
|
||||
* \brief Constructor. Do not call directly, use CBotVar::Create()
|
||||
*/
|
||||
CBotVarString(const CBotToken* name);
|
||||
CBotVarString(const CBotToken& name);
|
||||
|
||||
void SetValString(const std::string& val) override;
|
||||
std::string GetValString() override;
|
||||
|
|
Loading…
Reference in New Issue