diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-19 22:09:25 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2013-03-25 20:32:36 +0100 |
commit | 7aeb3b4a6c34a8f679719c207e51394d7e48828b (patch) | |
tree | c92af607288f041944f7a876e3a9478b35ba6499 /src/game-server/state.cpp | |
parent | 7aee56f062989c8901322a09b2da40bb028eb222 (diff) | |
download | manaserv-7aeb3b4a6c34a8f679719c207e51394d7e48828b.tar.gz manaserv-7aeb3b4a6c34a8f679719c207e51394d7e48828b.tar.bz2 manaserv-7aeb3b4a6c34a8f679719c207e51394d7e48828b.tar.xz manaserv-7aeb3b4a6c34a8f679719c207e51394d7e48828b.zip |
Changed Effect to a component of Actor
Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/game-server/state.cpp')
-rw-r--r-- | src/game-server/state.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index d84f35b2..ab0dcd79 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -355,10 +355,11 @@ static void informPlayer(MapComposite *map, Character *p) for (FixedActorIterator it(map->getAroundBeingIterator(p, visualRange)); it; ++it) { - assert((*it)->getType() == OBJECT_ITEM || - (*it)->getType() == OBJECT_EFFECT); - Actor *o = *it; + + assert(o->getType() == OBJECT_ITEM || + o->getType() == OBJECT_EFFECT); + Point opos = o->getPosition(); int oflags = o->getUpdateFlags(); bool willBeInRange = ppos.inRangeOf(opos, visualRange); @@ -394,21 +395,21 @@ static void informPlayer(MapComposite *map, Character *p) break; case OBJECT_EFFECT: { - Effect *o = static_cast< Effect * >(*it); - o->show(); + EffectComponent *e = o->getComponent<EffectComponent>(); + e->setShown(); // Don't show old effects if (!(oflags & UPDATEFLAG_NEW_ON_MAP)) break; - Being *b = o->getBeing(); - if (b) + + if (Being *b = e->getBeing()) { MessageOut effectMsg(GPMSG_CREATE_EFFECT_BEING); - effectMsg.writeInt16(o->getEffectId()); + effectMsg.writeInt16(e->getEffectId()); effectMsg.writeInt16(b->getPublicID()); gameHandler->sendTo(p, effectMsg); } else { MessageOut effectMsg(GPMSG_CREATE_EFFECT_POS); - effectMsg.writeInt16(o->getEffectId()); + effectMsg.writeInt16(e->getEffectId()); effectMsg.writeInt16(opos.x); effectMsg.writeInt16(opos.y); gameHandler->sendTo(p, effectMsg); @@ -559,7 +560,7 @@ bool GameState::insert(Entity *ptr) case OBJECT_EFFECT: LOG_DEBUG("Effect inserted: " - << static_cast<Effect*>(obj)->getEffectId()); + << obj->getComponent<EffectComponent>()->getEffectId()); break; case OBJECT_MONSTER: @@ -633,7 +634,7 @@ void GameState::remove(Entity *ptr) case OBJECT_EFFECT: LOG_DEBUG("Effect removed: " - << static_cast<Effect*>(ptr)->getEffectId()); + << ptr->getComponent<EffectComponent>()->getEffectId()); break; case OBJECT_MONSTER: |