本文整理汇总了C++中CBotVar::IsStatic方法的典型用法代码示例。如果您正苦于以下问题:C++ CBotVar::IsStatic方法的具体用法?C++ CBotVar::IsStatic怎么用?C++ CBotVar::IsStatic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBotVar
的用法示例。
在下文中一共展示了CBotVar::IsStatic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveStaticState
bool CBotClass::SaveStaticState(FILE* pf)
{
if (!WriteWord( pf, CBOTVERSION*2)) return false;
// saves the state of static variables in classes
CBotClass* p = m_ExClass;
while ( p != NULL )
{
if (!WriteWord( pf, 1)) return false;
// save the name of the class
if (!WriteString( pf, p->GetName() )) return false;
CBotVar* pv = p->GetVar();
while( pv != NULL )
{
if ( pv->IsStatic() )
{
if (!WriteWord( pf, 1)) return false;
if (!WriteString( pf, pv->GetName() )) return false;
if ( !pv->Save0State(pf)) return false; // common header
if ( !pv->Save1State(pf) ) return false; // saves as the child class
if ( !WriteWord( pf, 0)) return false;
}
pv = pv->GetNext();
}
if (!WriteWord( pf, 0)) return false;
p = p->m_ExNext;
}
if (!WriteWord( pf, 0)) return false;
return true;
}
示例2: CompileDefItem
//.........这里部分代码省略.........
{
if (pf->GetName() == pp->GetString()) break;
prev = pf;
pf = pf->Next();
}
bool bConstructor = (pp->GetString() == GetName());
CBotCStack* pile = pStack->TokenStack(NULL, true);
// make "this" known
CBotToken TokenThis(CBotString("this"), CBotString());
CBotVar* pThis = CBotVar::Create(&TokenThis, CBotTypResult( CBotTypClass, this ) );
pThis->SetUniqNum(-2);
pile->AddVar(pThis);
if ( m_pParent )
{
// makes "super" known
CBotToken TokenSuper(CBotString("super"), CBotString());
CBotVar* pThis = CBotVar::Create(&TokenSuper, CBotTypResult( CBotTypClass, m_pParent ) );
pThis->SetUniqNum(-3);
pile->AddVar(pThis);
}
// int num = 1;
CBotClass* my = this;
while (my != NULL)
{
// places a copy of variables of a class (this) on a stack
CBotVar* pv = my->m_pVar;
while (pv != NULL)
{
CBotVar* pcopy = CBotVar::Create(pv);
pcopy->SetInit(!bConstructor || pv->IsStatic());
pcopy->SetUniqNum(pv->GetUniqNum());
pile->AddVar(pcopy);
pv = pv->GetNext();
}
my = my->m_pParent;
}
// compiles a method
p = pBase;
CBotFunction* f =
CBotFunction::Compile(p, pile, NULL/*, false*/);
if ( f != NULL )
{
f->m_pProg = pStack->GetBotCall();
f->m_bSynchro = bSynchro;
// replaces the element in the chain
f->m_next = pf->m_next;
pf->m_next = NULL;
delete pf;
if (prev == NULL) m_pMethod = f;
else prev->m_next = f;
}
pStack->Return(NULL, pile);
}
return pStack->IsOk();
}
// definition of an element
if (type.Eq(0))
{