diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2013-04-15 22:15:31 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2013-04-15 22:15:31 +0200 |
commit | c53bc90dbaa876a86f762a3d864b1f920e2b8071 (patch) | |
tree | 1a8174f4d1745a4799210db970aa2230df622d34 /src/game-server/effect.cpp | |
parent | b89e404f85358f2e3ff87d7731376dbeacdf9778 (diff) | |
parent | 81be8dc99ba7558c8915310eed095df43e3bdbf7 (diff) | |
download | manaserv-c53bc90dbaa876a86f762a3d864b1f920e2b8071.tar.gz manaserv-c53bc90dbaa876a86f762a3d864b1f920e2b8071.tar.bz2 manaserv-c53bc90dbaa876a86f762a3d864b1f920e2b8071.tar.xz manaserv-c53bc90dbaa876a86f762a3d864b1f920e2b8071.zip |
Merge branch 'master' into lpc2012
Conflicts:
src/account-server/accounthandler.cpp
src/game-server/character.cpp
Diffstat (limited to 'src/game-server/effect.cpp')
-rw-r--r-- | src/game-server/effect.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/src/game-server/effect.cpp b/src/game-server/effect.cpp index b7c6c643..42142c5e 100644 --- a/src/game-server/effect.cpp +++ b/src/game-server/effect.cpp @@ -1,6 +1,7 @@ /* * The Mana Server * Copyright (C) 2004-2010 The Mana World Development Team + * Copyright (C) 2012 The Mana Developers * * This file is part of The Mana Server. * @@ -20,29 +21,43 @@ #include "game-server/effect.h" -#include "game-server/mapcomposite.h" +#include "game-server/being.h" +#include "game-server/entity.h" #include "game-server/state.h" -void Effect::update() +void EffectComponent::update(Entity &entity) { if (mHasBeenShown) - GameState::enqueueRemove(this); + GameState::enqueueRemove(&entity); } namespace Effects { void show(int id, MapComposite *map, const Point &pos) { - Effect *effect = new Effect(id); + 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, MapComposite *map, Being *b) + + void show(int id, Entity *b) { - Effect *effect = new Effect(id); - effect->setMap(map); - if (effect->setBeing(b)) - GameState::enqueueInsert(effect); + EffectComponent *effectComponent = new EffectComponent(id); + effectComponent->setBeing(b); + + Entity *effect = new Entity(OBJECT_EFFECT); + auto *actorComponent = new ActorComponent(*effect); + effect->addComponent(actorComponent); + effect->addComponent(effectComponent); + effect->setMap(b->getMap()); + const Point &point = b->getComponent<ActorComponent>()->getPosition(); + actorComponent->setPosition(*effect, point); + + GameState::enqueueInsert(effect); } } |