本文整理汇总了C++中CBotVar::GivValString方法的典型用法代码示例。如果您正苦于以下问题:C++ CBotVar::GivValString方法的具体用法?C++ CBotVar::GivValString怎么用?C++ CBotVar::GivValString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBotVar
的用法示例。
在下文中一共展示了CBotVar::GivValString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rMajObject
// routine pour mettre à jour l'instance de la classe Bot courante
void rMajObject( CBotVar* pThis, void* pUser )
{
if (!pThis->IsElemOfClass("object"))
return ;
CBotVar* pPos = pThis->GivItem("position");
CBotVar* pX = pPos->GivItem("x");
CBotVar* pY = pPos->GivItem("y");
CBotVar* pZ = pPos->GivItem("z");
// CBotVar* pPt = pThis->GivItem("transport");
CBotString p = pX->GivValString();
// pX->SetValFloat( pUser == (void*)1 ? (float)12.5 : (float)44.4 );
pZ->SetValFloat( (float)0 );
pY->SetValFloat( (float)-3.33 );
pX->SetValFloat( pX->GivValFloat() + 10 ) ;
// pX = pThis->GivItem( "xx" );
// pX->SetValFloat( (float)22 );
// crée une instance sur une classe object
// CBotVar* pAutre = CBotVar::Create("autre", CBotTypClass, "object");
// pAutre->SetUserPtr( (void*)3 );
// pPt->SetPointer( pAutre );
// pPt->SetPointer( NULL );
// delete pAutre;
}
示例2: 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;
}