diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/game-server/monster.hpp | 12 | ||||
-rw-r--r-- | src/game-server/state.cpp | 10 |
3 files changed, 26 insertions, 3 deletions
@@ -1,4 +1,9 @@ -2007-07-20 Bjørn Lindeijer <bjorn@lindeijer.nl> +2007-07-23 Guillaume Melquiond <guillaume.melquiond@gmail.com> + + * src/game-server/monster.hpp, src/game-server/state.cpp: Sent proper + monster identifiers. + +2007-07-20 Bjørn Lindeijer <bjorn@lindeijer.nl> * src/chat-server/chatclient.hpp, src/chat-server/chathandler.cpp, src/Makefile.am: Separated ChatClient class from chathandler.cpp. 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 } |