diff options
Diffstat (limited to 'src/net/tmwserv/effecthandler.cpp')
-rw-r--r-- | src/net/tmwserv/effecthandler.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/net/tmwserv/effecthandler.cpp b/src/net/tmwserv/effecthandler.cpp index 34da9c7d..a9960936 100644 --- a/src/net/tmwserv/effecthandler.cpp +++ b/src/net/tmwserv/effecthandler.cpp @@ -25,14 +25,17 @@ #include "net/messagein.h" +#include "beingmanager.h" #include "effectmanager.h" +#include "log.h" namespace TmwServ { EffectHandler::EffectHandler() { static const Uint16 _messages[] = { - GPMSG_CREATE_EFFECT, + GPMSG_CREATE_EFFECT_POS, + GPMSG_CREATE_EFFECT_BEING, 0 }; handledMessages = _messages; @@ -42,15 +45,18 @@ void EffectHandler::handleMessage(MessageIn &msg) { switch (msg.getId()) { - case GPMSG_CREATE_EFFECT: - handleCreateEffects(msg); + case GPMSG_CREATE_EFFECT_POS: + handleCreateEffectPos(msg); + break; + case GPMSG_CREATE_EFFECT_BEING: + handleCreateEffectBeing(msg); break; default: break; } } -void EffectHandler::handleCreateEffects(MessageIn &msg) +void EffectHandler::handleCreateEffectPos(MessageIn &msg) { int id = msg.readInt16(); Uint16 x = msg.readInt16(); @@ -58,4 +64,17 @@ void EffectHandler::handleCreateEffects(MessageIn &msg) effectManager->trigger(id, x, y); } +void EffectHandler::handleCreateEffectBeing(MessageIn &msg) +{ + int eid = msg.readInt16(); + int bid = msg.readInt16(); + Being* b = beingManager->findBeing(bid); + if (b) + { + effectManager->trigger(eid, b); + } else { + logger->log("Warning: CreateEffect called for unknown being #%d", bid); + } +} + } // namespace TmwServ |