diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-11 11:10:47 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-12 14:56:28 +0200 |
commit | 9e6a0f98ecb52e04ab5afce817cb1d7fe2076450 (patch) | |
tree | 97b6ffedbfbaf09389fe05c1d183471a97740ebb /src/game-server/effect.cpp | |
parent | d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da (diff) | |
download | manaserv-9e6a0f98ecb52e04ab5afce817cb1d7fe2076450.tar.gz manaserv-9e6a0f98ecb52e04ab5afce817cb1d7fe2076450.tar.bz2 manaserv-9e6a0f98ecb52e04ab5afce817cb1d7fe2076450.tar.xz manaserv-9e6a0f98ecb52e04ab5afce817cb1d7fe2076450.zip |
Moved Actor into an Component
This was the final step to remove the hierachy with Entity on the top.
Diffstat (limited to 'src/game-server/effect.cpp')
-rw-r--r-- | src/game-server/effect.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/game-server/effect.cpp b/src/game-server/effect.cpp index b8e03dab..94f4613c 100644 --- a/src/game-server/effect.cpp +++ b/src/game-server/effect.cpp @@ -30,30 +30,35 @@ const ComponentType EffectComponent::type; void EffectComponent::update(Entity &entity) { if (mHasBeenShown) - GameState::enqueueRemove(static_cast<Actor*>(&entity)); + GameState::enqueueRemove(&entity); } namespace Effects { void show(int id, MapComposite *map, const Point &pos) { - Actor *effect = new Actor(OBJECT_EFFECT); + Entity *effect = new Entity(OBJECT_EFFECT); + auto *actorComponent = new ActorComponent(*effect); + effect->addComponent(actorComponent); effect->addComponent(new EffectComponent(id)); effect->setMap(map); - effect->setPosition(pos); + actorComponent->setPosition(*effect, pos); GameState::enqueueInsert(effect); } - void show(int id, Actor *b) + void show(int id, Entity *b) { EffectComponent *effectComponent = new EffectComponent(id); effectComponent->setBeing(b); - Actor *effect = new Actor(OBJECT_EFFECT); + Entity *effect = new Entity(OBJECT_EFFECT); + auto *actorComponent = new ActorComponent(*effect); + effect->addComponent(actorComponent); effect->addComponent(effectComponent); effect->setMap(b->getMap()); - effect->setPosition(b->getPosition()); + const Point &point = b->getComponent<ActorComponent>()->getPosition(); + actorComponent->setPosition(*effect, point); GameState::enqueueInsert(effect); } |