本文整理汇总了C++中MapComposite::update方法的典型用法代码示例。如果您正苦于以下问题:C++ MapComposite::update方法的具体用法?C++ MapComposite::update怎么用?C++ MapComposite::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapComposite
的用法示例。
在下文中一共展示了MapComposite::update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void GameState::update(int tick)
{
currentTick = tick;
#ifndef NDEBUG
dbgLockObjects = true;
#endif
ScriptManager::currentState()->update();
// Update game state (update AI, etc.)
const MapManager::Maps &maps = MapManager::getMaps();
for (MapManager::Maps::const_iterator m = maps.begin(),
m_end = maps.end(); m != m_end; ++m)
{
MapComposite *map = m->second;
if (!map->isActive())
continue;
map->update();
for (CharacterIterator p(map->getWholeMapIterator()); p; ++p)
{
informPlayer(map, *p);
}
for (ActorIterator it(map->getWholeMapIterator()); it; ++it)
{
Actor *a = *it;
a->clearUpdateFlags();
if (a->canFight())
{
static_cast< Being * >(a)->clearHitsTaken();
}
}
}
# ifndef NDEBUG
dbgLockObjects = false;
# endif
// Take care of events that were delayed because of their side effects.
for (DelayedEvents::iterator it = delayedEvents.begin(),
it_end = delayedEvents.end(); it != it_end; ++it)
{
const DelayedEvent &e = it->second;
Actor *o = it->first;
switch (e.type)
{
case EVENT_REMOVE:
remove(o);
if (o->getType() == OBJECT_CHARACTER)
{
Character *ch = static_cast< Character * >(o);
ch->disconnected();
gameHandler->kill(ch);
}
delete o;
break;
case EVENT_INSERT:
insertOrDelete(o);
break;
case EVENT_WARP:
assert(o->getType() == OBJECT_CHARACTER);
warp(static_cast< Character * >(o), e.map, e.x, e.y);
break;
}
}
delayedEvents.clear();
}