本文整理汇总了C++中RootEntity::isDefaultLoc方法的典型用法代码示例。如果您正苦于以下问题:C++ RootEntity::isDefaultLoc方法的具体用法?C++ RootEntity::isDefaultLoc怎么用?C++ RootEntity::isDefaultLoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RootEntity
的用法示例。
在下文中一共展示了RootEntity::isDefaultLoc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
void View::create(const RootEntity& gent)
{
std::string eid(gent->getId());
if (m_contents.count(eid))
{
// already known locally, just emit the signal
EntityCreated.emit( m_contents[eid] );
return;
}
bool alreadyAppeared = false;
PendingSightMap::iterator pending = m_pending.find(eid);
if (pending != m_pending.end())
{
// already being retrieved, but we have the data now
alreadyAppeared = (pending->second == SACTION_QUEUED) ||
(pending->second == SACTION_APPEAR);
pending->second = SACTION_DISCARD; // when the SIGHT turns up
}
Entity* ent = createEntity(gent);
m_contents[eid] = ent;
ent->init(gent, true);
if (gent->isDefaultLoc()) setTopLevelEntity(ent);
InitialSightEntity.emit(ent);
// depends on relative order that sight(create) and appear are received in
if (alreadyAppeared)
{
ent->setVisible(true);
EntityCreated.emit(ent);
}
}
示例2: sight
void View::sight(const RootEntity& gent)
{
bool visible = true;
std::string eid = gent->getId();
PendingSightMap::iterator pending = m_pending.find(eid);
// examine the pending map, to see what we should do with this entity
if (pending != m_pending.end()) {
switch (pending->second)
{
case SACTION_APPEAR:
visible = true;
break;
case SACTION_DISCARD:
m_pending.erase(pending);
issueQueuedLook();
return;
case SACTION_HIDE:
visible = false;
break;
case SACTION_QUEUED:
error() << "got sight of queued entity " << eid << " somehow";
eraseFromLookQueue(eid);
break;
default:
throw InvalidOperation("got bad pending action for entity");
}
m_pending.erase(pending);
}
// if we got this far, go ahead and build / update it
Entity *ent = getEntity(eid);
if (ent) {
// existing entity, update in place
ent->sight(gent);
} else {
ent = initialSight(gent);
EntitySeen.emit(ent);
}
if (gent->isDefaultLoc()) { // new top level entity
setTopLevelEntity(ent);
}
ent->setVisible(visible);
issueQueuedLook();
}