本文整理汇总了C++中behaviac::vector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ vector::size方法的具体用法?C++ vector::size怎么用?C++ vector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类behaviac::vector
的用法示例。
在下文中一共展示了vector::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
virtual void load(const char* instance, behaviac::vector<behaviac::string>& paramStrs)
{
BEHAVIAC_ASSERT(paramStrs.size() == 1);
behaviac::StringUtils::StringCopySafe(kInstanceNameMax, _instance, instance);
_param0 = AgentMeta::TParseProperty<IList >(paramStrs[0].c_str());
}
示例2: ParseProperty
//[property] WorldState::WorldState int WorldState::time->185606213
//[property] Ship::Ship_2_3 long GameObject::age->91291
//[property] Ship::Ship_2_3 bool par_a->true
void Workspace::ParseProperty(const behaviac::vector<behaviac::string>& tokens)
{
BEHAVIAC_UNUSED_VAR(tokens);
#if !BEHAVIAC_RELEASE
const behaviac::string& agentName = tokens[1];
Agent* pAgent = Agent::GetAgent(agentName.c_str());
//pAgent could be 0
if (pAgent && tokens.size() == 4)
{
//const behaviac::string& varTypeName = tokens[2];
const behaviac::string& varNameValue = tokens[3];
behaviac::string::size_type posb = varNameValue.find("->");
BEHAVIAC_ASSERT(posb != behaviac::string::npos);
if (posb != behaviac::string::npos)
{
behaviac::string::size_type size = behaviac::string::npos;
//varNameValue is the last one with '\n'
behaviac::string::size_type pose = varNameValue.find('\n');
if (pose != behaviac::string::npos)
{
size = pose - posb - 1;
}
behaviac::string varName = varNameValue.substr(0, posb);
behaviac::string varValue = varNameValue.substr(posb + 2, size);
if (pAgent)
{
pAgent->SetVariableFromString(varName.c_str(), varValue.c_str());
}//end of if (pAgent)
}
}
#endif
}
示例3: SelectorUpdate
EBTStatus Selector::SelectorUpdate(Agent* pAgent, EBTStatus childStatus, int& activeChildIndex, behaviac::vector<BehaviorTask*>& children)
{
EBTStatus s = childStatus;
int childSize = (int)children.size();
for (;;)
{
BEHAVIAC_ASSERT(activeChildIndex < childSize);
if (s == BT_RUNNING)
{
BehaviorTask* pBehavior = children[activeChildIndex];
if (this->CheckIfInterrupted(pAgent))
{
return BT_FAILURE;
}
s = pBehavior->exec(pAgent);
}
// If the child fails, or keeps running, do the same.
if (s != BT_FAILURE)
{
return s;
}
// Hit the end of the array, job done!
++activeChildIndex;
if (activeChildIndex >= childSize)
{
return BT_FAILURE;
}
s = BT_RUNNING;
}
}