本文整理汇总了C++中CBotVar::GivNext方法的典型用法代码示例。如果您正苦于以下问题:C++ CBotVar::GivNext方法的具体用法?C++ CBotVar::GivNext怎么用?C++ CBotVar::GivNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBotVar
的用法示例。
在下文中一共展示了CBotVar::GivNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rSpace
bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
{
CScript* script = ((CObject*)user)->RetRunScript();
CObject* pThis = (CObject*)user;
CBotVar* pSub;
Math::Vector center;
float rMin, rMax, dist;
rMin = 5.0f*UNIT;
rMax = 50.0f*UNIT;
dist = 4.0f*UNIT;
if ( var == 0 )
{
center = pThis->RetPosition(0);
}
else
{
if ( !GetPoint(var, exception, center) ) return true;
if ( var != 0 )
{
rMin = var->GivValFloat()*UNIT;
var = var->GivNext();
if ( var != 0 )
{
rMax = var->GivValFloat()*UNIT;
var = var->GivNext();
if ( var != 0 )
{
dist = var->GivValFloat()*UNIT;
var = var->GivNext();
}
}
}
}
script->m_main->FreeSpace(center, rMin, rMax, dist, pThis);
if ( result != 0 )
{
pSub = result->GivItemList();
if ( pSub != 0 )
{
pSub->SetValFloat(center.x/UNIT);
pSub = pSub->GivNext(); // "y"
pSub->SetValFloat(center.z/UNIT);
pSub = pSub->GivNext(); // "z"
pSub->SetValFloat(center.y/UNIT);
}
}
return true;
}
示例2: rSpace
BOOL rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
{
CBotVar* pSub;
float rMin, rMax, dist;
rMin = 5.0f*UNIT;
rMax = 50.0f*UNIT;
dist = 4.0f*UNIT;
if ( var == 0 )
{
// center = pThis->RetPosition(0);
}
else
{
if ( var != 0 )
{
rMin = var->GivValFloat()*UNIT;
var = var->GivNext();
if ( var != 0 )
{
rMax = var->GivValFloat()*UNIT;
var = var->GivNext();
if ( var != 0 )
{
dist = var->GivValFloat()*UNIT;
var = var->GivNext();
}
}
}
}
if ( result != 0 )
{
pSub = result->GivItemList();
if ( pSub != 0 )
{
pSub->SetValFloat(1);
pSub = pSub->GivNext(); // "y"
pSub->SetValFloat(2);
pSub = pSub->GivNext(); // "z"
// pSub->SetValFloat(3);
}
}
return TRUE;
}
示例3: OnTest
//.........这里部分代码省略.........
m_pEdit->SetFocus();
return;
}
pf = fOpen( "TEST.CBO", "rb" );
CBotClass::RestoreStaticState(pf);
m_pProg->RestoreState(pf);
fClose(pf);
int start2, end2;
m_pProg->GetRunPos(FunctionName, start2, end2);
if ( end2 <= 0 )
m_pProg->GetRunPos(FunctionName, start2, end2);
if ( start1 != start2 || end1 != end2 )
m_pProg->GetRunPos(FunctionName, start2, end2);
m_pEdit->SetSel(start2, end2);
}
if (m_pProg->GetError(code, start, end))
{
m_pEdit->SetSel(start, end);
TextError = CBotProgram::GivErrorText(code);
AfxMessageBox(TextError);
}
return;}
while (!m_pProg->Run(NULL, 0))
{
const char* FunctionName;
int start, end;
m_pProg->GetRunPos(FunctionName, start, end);
m_pEdit->SetSel(start, end);
if ( FunctionName == NULL ) continue;
CString info (FunctionName);
CString sep (":\n");
int level = 0;
const char* Name;
while ( TRUE )
{
CBotVar* pVar = m_pProg->GivStackVars(Name, level--);
if ( Name != FunctionName ) break;
if ( pVar == NULL ) continue;
// pVar->Maj(NULL, FALSE);
while ( pVar != NULL )
{
info += sep;
info += pVar->GivName() + CBotString(" = ") + pVar->GivValString();
sep = ", ";
pVar = pVar->GivNext();
}
sep = "\n";
}
if ( IDOK != AfxMessageBox(info, MB_OKCANCEL) ) break;
if ( test == 1 )
{
test = 0;
FILE* pf;
pf = fOpen( "TEST.CBO", "wb" );
m_pProg->SaveState(pf);
fClose(pf);
}
if ( test == 2 )
{
test = 0;
FILE* pf;
pf = fOpen( "TEST.CBO", "rb" );
m_pProg->RestoreState(pf);
fClose(pf);
}
if ( test == 12 )
{
test = 0;
FILE* pf;
pf = fOpen( "TEST.CBO", "wb" );
m_pProg->SaveState(pf);
fClose(pf);
pf = fOpen( "TEST.CBO", "rb" );
m_pProg->RestoreState(pf);
fClose(pf);
test = 13;
}
}
if (m_pProg->GetError(code, start, end))
{
m_pEdit->SetSel(start, end);
TextError = CBotProgram::GivErrorText(code);
AfxMessageBox(TextError);
}
delete pThisRobot;
}