本文整理汇总了C++中RootEntity::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ RootEntity::getParent方法的具体用法?C++ RootEntity::getParent怎么用?C++ RootEntity::getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RootEntity
的用法示例。
在下文中一共展示了RootEntity::getParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
LocatedEntity * CharacterClient::sendLook(const Operation & op)
{
OpVector result;
if (sendAndWaitReply(op, result) != 0) {
std::cerr << "No reply to look" << std::endl << std::flush;
return NULL;
}
assert(!result.empty());
const Operation & res = result.front();
if (!res.isValid()) {
std::cerr << "NULL reply to look" << std::endl << std::flush;
return NULL;
}
const std::string & resparent = res->getParent();
if (resparent == "unseen") {
return NULL;
}
if (resparent != "sight") {
std::cerr << "Reply to look is " << resparent << " not sight" << std::endl << std::flush;
return NULL;
}
if (res->getArgs().empty()) {
std::cerr << "Reply to look has no args" << std::endl << std::flush;
return NULL;
}
RootEntity seen = smart_dynamic_cast<RootEntity>(res->getArgs().front());
if (!seen.isValid()) {
std::cerr << "Sight arg is not an entity" << std::endl << std::flush;
return NULL;
}
if (!seen->hasAttrFlag(Atlas::Objects::ID_FLAG)) {
std::cerr << "Looked at entity has no id" << std::endl << std::flush;
return NULL;
}
const std::string & sight_id = seen->getId();
if (seen->hasAttrFlag(Atlas::Objects::PARENT_FLAG)) {
std::cout << "Seen: " << seen->getParent()
<< "(" << sight_id << ")" << std::endl << std::flush;
} else {
std::cout << "Seen: " << sight_id << std::endl << std::flush;
}
LocatedEntity * obj = m_map.updateAdd(seen, res->getSeconds());
return obj;
}