diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-07-23 15:01:45 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-07-23 15:01:45 +0000 |
commit | 091a57aca17453b08e2a912a6ed19c09131e2123 (patch) | |
tree | fdd3d71241cb02ffd72bba32de43c0012b150425 /src | |
parent | 2c0a5ba8f1334b9ea3c0935ed16c7c580bb33243 (diff) | |
download | manaserv-091a57aca17453b08e2a912a6ed19c09131e2123.tar.gz manaserv-091a57aca17453b08e2a912a6ed19c09131e2123.tar.bz2 manaserv-091a57aca17453b08e2a912a6ed19c09131e2123.tar.xz manaserv-091a57aca17453b08e2a912a6ed19c09131e2123.zip |
Sent proper monster identifiers.
Diffstat (limited to 'src')
-rw-r--r-- | src/game-server/monster.hpp | 12 | ||||
-rw-r--r-- | src/game-server/state.cpp | 10 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/game-server/monster.hpp b/src/game-server/monster.hpp index f9614ecd..19625f56 100644 --- a/src/game-server/monster.hpp +++ b/src/game-server/monster.hpp @@ -52,6 +52,12 @@ class MonsterClass MonsterClass(int id): mID(id) {} /** + * Gets monster type. + */ + int getType() const + { return mID; } + + /** * Sets monster drops. */ void setDrops(MonsterDrops const &v) @@ -102,6 +108,12 @@ class Monster : public Being, public DeathListener ~Monster(); /** + * Gets monster specy. + */ + MonsterClass *getSpecy() + { return mSpecy; } + + /** * Performs one step of controller logic. */ void update(); diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index ace40d97..d9922df7 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -23,6 +23,8 @@ #include <cassert> +#include "game-server/state.hpp" + #include "defines.h" #include "point.h" #include "game-server/accountconnection.hpp" @@ -33,7 +35,7 @@ #include "game-server/map.hpp" #include "game-server/mapcomposite.hpp" #include "game-server/mapmanager.hpp" -#include "game-server/state.hpp" +#include "game-server/monster.hpp" #include "net/messageout.hpp" #include "utils/logger.h" @@ -252,6 +254,7 @@ static void informPlayer(MapComposite *map, Character *p) enterMsg.writeShort(opos.x); enterMsg.writeShort(opos.y); switch (otype) { + case OBJECT_CHARACTER: { Character *q = static_cast< Character * >(o); @@ -261,10 +264,13 @@ static void informPlayer(MapComposite *map, Character *p) enterMsg.writeByte(q->getGender()); serializeLooks(q, enterMsg, true); } break; + case OBJECT_MONSTER: { - enterMsg.writeShort(0); // TODO: The monster ID + Monster *q = static_cast< Monster * >(o); + enterMsg.writeShort(q->getSpecy()->getType()); } break; + default: assert(false); // TODO } |