Removed some unused CBot code
parent
73f8bd5490
commit
76c04e10d5
|
@ -322,10 +322,6 @@ void CBotCStack::AddVar(CBotVar* pVar)
|
||||||
while ( *pp != nullptr ) pp = &(*pp)->m_next;
|
while ( *pp != nullptr ) pp = &(*pp)->m_next;
|
||||||
|
|
||||||
*pp = pVar; // added after
|
*pp = pVar; // added after
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
if ( pVar->GetUniqNum() == 0 ) assert(0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -213,7 +213,6 @@ bool CBotClass::AddItem(std::string name,
|
||||||
CBotTypResult type,
|
CBotTypResult type,
|
||||||
int mPrivate)
|
int mPrivate)
|
||||||
{
|
{
|
||||||
CBotToken token(name, std::string());
|
|
||||||
CBotClass* pClass = type.GetClass();
|
CBotClass* pClass = type.GetClass();
|
||||||
|
|
||||||
CBotVar* pVar = CBotVar::Create( name, type );
|
CBotVar* pVar = CBotVar::Create( name, type );
|
||||||
|
|
|
@ -286,9 +286,6 @@ bool CBotExprVar::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* prevToke
|
||||||
pVar = pj->FindVar(m_nIdent, true); // tries with the variable update if necessary
|
pVar = pj->FindVar(m_nIdent, true); // tries with the variable update if necessary
|
||||||
if (pVar == nullptr)
|
if (pVar == nullptr)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
|
||||||
assert(0);
|
|
||||||
#endif
|
|
||||||
pj->SetError(1, &m_token);
|
pj->SetError(1, &m_token);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,10 +338,6 @@ bad:
|
||||||
return pStack->ReturnFunc(nullptr, pStk);
|
return pStack->ReturnFunc(nullptr, pStk);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
static int xx = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool CBotFunction::Execute(CBotVar** ppVars, CBotStack* &pj, CBotVar* pInstance)
|
bool CBotFunction::Execute(CBotVar** ppVars, CBotStack* &pj, CBotVar* pInstance)
|
||||||
{
|
{
|
||||||
|
@ -652,9 +648,6 @@ int CBotFunction::DoCall(long& nIdent, const std::string& name, CBotVar** ppVars
|
||||||
{
|
{
|
||||||
if ( !pStk3->IsOk() && pt->m_pProg != m_pProg )
|
if ( !pStk3->IsOk() && pt->m_pProg != m_pProg )
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
|
||||||
if ( m_pProg->GetFunctions()->GetName() == "LaCommande" ) return false;
|
|
||||||
#endif
|
|
||||||
pStk3->SetPosError(pToken); // indicates the error on the procedure call
|
pStk3->SetPosError(pToken); // indicates the error on the procedure call
|
||||||
}
|
}
|
||||||
return false; // interrupt !
|
return false; // interrupt !
|
||||||
|
|
|
@ -284,7 +284,6 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool CBotInstr::Execute(CBotStack* &pj)
|
bool CBotInstr::Execute(CBotStack* &pj)
|
||||||
{
|
{
|
||||||
std::string ClassManquante = name;
|
|
||||||
assert(0); // should never go through this routine
|
assert(0); // should never go through this routine
|
||||||
// but use the routines of the subclasses
|
// but use the routines of the subclasses
|
||||||
return false;
|
return false;
|
||||||
|
@ -301,7 +300,6 @@ bool CBotInstr::Execute(CBotStack* &pj, CBotVar* pVar)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CBotInstr::RestoreState(CBotStack* &pj, bool bMain)
|
void CBotInstr::RestoreState(CBotStack* &pj, bool bMain)
|
||||||
{
|
{
|
||||||
std::string ClassManquante = name;
|
|
||||||
assert(0); // should never go through this routine
|
assert(0); // should never go through this routine
|
||||||
// but use the routines of the subclasses
|
// but use the routines of the subclasses
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,9 +222,6 @@ bool CBotLeftExpr::ExecuteVar(CBotVar* &pVar, CBotStack* &pile, CBotToken* prevT
|
||||||
pVar = pile->FindVar(m_nIdent);
|
pVar = pile->FindVar(m_nIdent);
|
||||||
if (pVar == nullptr)
|
if (pVar == nullptr)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
|
||||||
assert(0);
|
|
||||||
#endif
|
|
||||||
pile->SetError(2, &m_token);
|
pile->SetError(2, &m_token);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,16 +245,8 @@ bool CBotProgram::Run(void* pUser, int timer)
|
||||||
ok = m_pStack->Execute();
|
ok = m_pStack->Execute();
|
||||||
if ( ok )
|
if ( ok )
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
|
||||||
CBotVar* ppVar[3];
|
|
||||||
ppVar[0] = CBotVar::Create("aa", CBotTypInt);
|
|
||||||
ppVar[1] = CBotVar::Create("bb", CBotTypInt);
|
|
||||||
ppVar[2] = nullptr;
|
|
||||||
ok = m_pRun->Execute(ppVar, m_pStack, m_pInstance);
|
|
||||||
#else
|
|
||||||
// returns to normal execution
|
// returns to normal execution
|
||||||
ok = m_pRun->Execute(nullptr, m_pStack, m_pInstance);
|
ok = m_pRun->Execute(nullptr, m_pStack, m_pInstance);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ok = m_pRun->Execute(nullptr, m_pStack, m_pInstance);
|
ok = m_pRun->Execute(nullptr, m_pStack, m_pInstance);
|
||||||
|
|
|
@ -75,15 +75,6 @@ CBotStack* CBotStack::FirstStack()
|
||||||
pp->m_bOver = true;
|
pp->m_bOver = true;
|
||||||
pp ++;
|
pp ++;
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
|
||||||
int n = 1;
|
|
||||||
pp = p;
|
|
||||||
for ( i = 0 ; i< MAXSTACK+10 ; i++ )
|
|
||||||
{
|
|
||||||
pp->m_index = n++;
|
|
||||||
pp ++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_error = 0; // avoids deadlocks because m_error is static
|
m_error = 0; // avoids deadlocks because m_error is static
|
||||||
return p;
|
return p;
|
||||||
|
@ -124,16 +115,10 @@ void CBotStack::Delete()
|
||||||
|
|
||||||
CBotStack* p = m_prev;
|
CBotStack* p = m_prev;
|
||||||
bool bOver = m_bOver;
|
bool bOver = m_bOver;
|
||||||
#ifdef _DEBUG
|
|
||||||
int n = m_index;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// clears the freed block
|
// clears the freed block
|
||||||
memset(this, 0, sizeof(CBotStack));
|
memset(this, 0, sizeof(CBotStack));
|
||||||
m_bOver = bOver;
|
m_bOver = bOver;
|
||||||
#ifdef _DEBUG
|
|
||||||
m_index = n;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( p == nullptr )
|
if ( p == nullptr )
|
||||||
free( this );
|
free( this );
|
||||||
|
@ -148,16 +133,10 @@ CBotStack* CBotStack::AddStack(CBotInstr* instr, UnknownEnumBlock bBlock)
|
||||||
return m_next; // included in an existing stack
|
return m_next; // included in an existing stack
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
int n = 0;
|
|
||||||
#endif
|
|
||||||
CBotStack* p = this;
|
CBotStack* p = this;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
p ++;
|
p ++;
|
||||||
#ifdef _DEBUG
|
|
||||||
n ++;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
while ( p->m_prev != nullptr );
|
while ( p->m_prev != nullptr );
|
||||||
|
|
||||||
|
@ -734,10 +713,6 @@ void CBotStack::AddVar(CBotVar* pVar)
|
||||||
while ( *pp != nullptr ) pp = &(*pp)->m_next;
|
while ( *pp != nullptr ) pp = &(*pp)->m_next;
|
||||||
|
|
||||||
*pp = pVar; // added after
|
*pp = pVar; // added after
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
if ( pVar->GetUniqNum() == 0 ) assert(0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -230,9 +230,6 @@ private:
|
||||||
CBotStack* m_prev;
|
CBotStack* m_prev;
|
||||||
friend class CBotInstArray;
|
friend class CBotInstArray;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
int m_index;
|
|
||||||
#endif
|
|
||||||
int m_state;
|
int m_state;
|
||||||
int m_step;
|
int m_step;
|
||||||
static int m_error;
|
static int m_error;
|
||||||
|
|
|
@ -113,17 +113,6 @@ CBotTypResult::~CBotTypResult()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int CBotTypResult::GetType(int mode) const
|
int CBotTypResult::GetType(int mode) const
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
|
||||||
if ( m_type == CBotTypPointer ||
|
|
||||||
m_type == CBotTypClass ||
|
|
||||||
m_type == CBotTypIntrinsic )
|
|
||||||
|
|
||||||
if ( m_pClass == nullptr ) assert(0);
|
|
||||||
|
|
||||||
|
|
||||||
if ( m_type == CBotTypArrayPointer )
|
|
||||||
if ( m_pNext == nullptr ) assert(0);
|
|
||||||
#endif
|
|
||||||
if ( mode == 3 && m_type == CBotTypNullPointer ) return CBotTypPointer;
|
if ( mode == 3 && m_type == CBotTypNullPointer ) return CBotTypPointer;
|
||||||
return m_type;
|
return m_type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,24 +68,6 @@ CBotVar::~CBotVar( )
|
||||||
delete m_next;
|
delete m_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void CBotVar::debug()
|
|
||||||
{
|
|
||||||
// const char* p = static_cast<const char*>( m_token->GetString());
|
|
||||||
std::string s = GetValString();
|
|
||||||
// const char* v = static_cast<const char*> (s);
|
|
||||||
|
|
||||||
if ( m_type.Eq(CBotTypClass) )
|
|
||||||
{
|
|
||||||
CBotVar* pv = (static_cast<CBotVarClass*>(this))->m_pVar;
|
|
||||||
while (pv != nullptr)
|
|
||||||
{
|
|
||||||
pv->debug();
|
|
||||||
pv = pv->GetNext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CBotVar::ConstructorSet()
|
void CBotVar::ConstructorSet()
|
||||||
{
|
{
|
||||||
|
|
|
@ -547,11 +547,6 @@ public:
|
||||||
*/
|
*/
|
||||||
static bool RestoreState(FILE* pf, CBotVar* &pVar);
|
static bool RestoreState(FILE* pf, CBotVar* &pVar);
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief debug
|
|
||||||
*/
|
|
||||||
void debug();
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Maj
|
* \brief Maj
|
||||||
* \param pUser
|
* \param pUser
|
||||||
|
|
Loading…
Reference in New Issue