diff options
author | Philipp Sehmisch <crush@themanaworld.org> | 2009-09-27 17:18:01 +0200 |
---|---|---|
committer | Philipp Sehmisch <crush@themanaworld.org> | 2009-09-27 17:18:01 +0200 |
commit | 2c1745f6a0fc3642a986aff5f3e23a79ee96450e (patch) | |
tree | 9c80000fcab35962d4579f074c30da7cfc2244a0 /src/net/tmwserv/effecthandler.cpp | |
parent | 658c737c051fc28fa1d33e6ac0d07a36e9d5f8e0 (diff) | |
download | mana-2c1745f6a0fc3642a986aff5f3e23a79ee96450e.tar.gz mana-2c1745f6a0fc3642a986aff5f3e23a79ee96450e.tar.bz2 mana-2c1745f6a0fc3642a986aff5f3e23a79ee96450e.tar.xz mana-2c1745f6a0fc3642a986aff5f3e23a79ee96450e.zip |
Client-sided netcode support for being-bound special effects
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 |