diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-09-02 11:58:35 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-09-02 11:58:35 +0000 |
commit | 2b322bf18d80acb464a9dc1820e581e7204cca1e (patch) | |
tree | 6938f1d8f63c8d8c1142b972117b42d2c50d1883 /src | |
parent | da43e09d2b043d5c75ad0adb87dd43f1fe36fe8f (diff) | |
download | mana-2b322bf18d80acb464a9dc1820e581e7204cca1e.tar.gz mana-2b322bf18d80acb464a9dc1820e581e7204cca1e.tar.bz2 mana-2b322bf18d80acb464a9dc1820e581e7204cca1e.tar.xz mana-2b322bf18d80acb464a9dc1820e581e7204cca1e.zip |
Switched to short IDs for beings.
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 2 | ||||
-rw-r--r-- | src/being.h | 8 | ||||
-rw-r--r-- | src/beingmanager.cpp | 4 | ||||
-rw-r--r-- | src/beingmanager.h | 4 | ||||
-rw-r--r-- | src/localplayer.cpp | 4 | ||||
-rw-r--r-- | src/localplayer.h | 2 | ||||
-rw-r--r-- | src/monster.cpp | 2 | ||||
-rw-r--r-- | src/monster.h | 2 | ||||
-rw-r--r-- | src/net/beinghandler.cpp | 9 | ||||
-rw-r--r-- | src/net/charserverhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/chathandler.cpp | 6 | ||||
-rw-r--r-- | src/net/protocol.h | 9 | ||||
-rw-r--r-- | src/npc.cpp | 2 | ||||
-rw-r--r-- | src/npc.h | 2 | ||||
-rw-r--r-- | src/player.cpp | 2 | ||||
-rw-r--r-- | src/player.h | 2 |
16 files changed, 32 insertions, 30 deletions
diff --git a/src/being.cpp b/src/being.cpp index b497d58f..a4bee426 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -46,7 +46,7 @@ PATH_NODE::PATH_NODE(Uint16 iX, Uint16 iY): { } -Being::Being(Uint32 id, Uint16 job, Map *map): +Being::Being(Uint16 id, Uint16 job, Map *map): mJob(job), mX(0), mY(0), mDirection(DOWN), mAction(STAND), diff --git a/src/being.h b/src/being.h index 7c08ab81..b2495a29 100644 --- a/src/being.h +++ b/src/being.h @@ -112,7 +112,7 @@ class Being : public Sprite /** * Constructor. */ - Being(Uint32 id, Uint16 job, Map *map); + Being(Uint16 id, Uint16 job, Map *map); /** * Destructor. @@ -274,14 +274,14 @@ class Being : public Sprite /** * Gets the sprite id. */ - Uint32 + Uint16 getId() const { return mId; } /** * Sets the sprite id. */ void - setId(Uint32 id) { mId = id; } + setId(Uint16 id) { mId = id; } /** * Sets the map the being is on @@ -348,7 +348,7 @@ class Being : public Sprite SpriteDirection getSpriteDirection() const; - Uint32 mId; /**< Unique sprite id */ + Uint16 mId; /**< Unique being id */ Uint8 mSex; /**< Character's gender */ Uint16 mWeapon; /**< Weapon picture id */ Uint16 mWalkSpeed; /**< Walking speed */ diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index 0156ce33..d2db055a 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -62,7 +62,7 @@ void BeingManager::setPlayer(LocalPlayer *player) mBeings.push_back(player); } -Being* BeingManager::createBeing(Uint32 id, Uint16 job) +Being* BeingManager::createBeing(Uint16 id, Uint16 job) { Being *being; @@ -90,7 +90,7 @@ void BeingManager::destroyBeing(Being *being) delete being; } -Being* BeingManager::findBeing(Uint32 id) +Being* BeingManager::findBeing(Uint16 id) { for (BeingIterator i = mBeings.begin(); i != mBeings.end(); i++) { diff --git a/src/beingmanager.h b/src/beingmanager.h index 0dbafcc6..c32884a0 100644 --- a/src/beingmanager.h +++ b/src/beingmanager.h @@ -48,7 +48,7 @@ class BeingManager /** * Create a being and add it to the list of beings */ - Being* createBeing(Uint32 id, Uint16 job); + Being* createBeing(Uint16 id, Uint16 job); /** * Remove a Being @@ -58,7 +58,7 @@ class BeingManager /** * Return a specific id Being */ - Being* findBeing(Uint32 id); + Being* findBeing(Uint16 id); /** * Return a being at specific coordinates diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 9df3ac3f..87a55744 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -37,8 +37,8 @@ LocalPlayer *player_node = NULL; -LocalPlayer::LocalPlayer(Uint32 id, Uint16 job, Map *map): - Player(id, job, map), +LocalPlayer::LocalPlayer(): + Player(65535, 0, NULL), mLevel(1), mInventory(new Inventory()), mTarget(NULL), mPickUpTarget(NULL), diff --git a/src/localplayer.h b/src/localplayer.h index 613f196a..886c3d11 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -42,7 +42,7 @@ class LocalPlayer : public Player STR = 0, AGI, VIT, INT, DEX, LUK }; - LocalPlayer(Uint32 id, Uint16 job, Map *map); + LocalPlayer(); virtual ~LocalPlayer(); diff --git a/src/monster.cpp b/src/monster.cpp index aba242b6..a4317e5e 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -29,7 +29,7 @@ #include "utils/tostring.h" -Monster::Monster(Uint32 id, Uint16 job, Map *map): +Monster::Monster(Uint16 id, Uint16 job, Map *map): Being(id, job, map) { mSprites[BASE_SPRITE] = new AnimatedSprite("graphics/sprites/monster" + toString(job - 1002) + ".xml", 0); diff --git a/src/monster.h b/src/monster.h index 6ce0d69d..0314a035 100644 --- a/src/monster.h +++ b/src/monster.h @@ -29,7 +29,7 @@ class Monster : public Being { public: - Monster(Uint32 id, Uint16 job, Map *map); + Monster(Uint16 id, Uint16 job, Map *map); virtual Type getType() const; }; diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index e3eb6eba..8ccd3dd6 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -398,7 +398,7 @@ void BeingHandler::handleBeingEnterMessage(MessageIn &msg) { int type = msg.readByte(); // type - int id = msg.readLong(); + int id = msg.readShort(); switch (type) { case OBJECT_PLAYER: @@ -431,8 +431,7 @@ BeingHandler::handleBeingEnterMessage(MessageIn &msg) void BeingHandler::handleBeingLeaveMessage(MessageIn &msg) { - msg.readByte(); // type, assume player for now, TODO - Being *being = beingManager->findBeing(msg.readLong()); + Being *being = beingManager->findBeing(msg.readShort()); if (!being) return; if (being == player_node->getTarget()) { @@ -443,9 +442,9 @@ void BeingHandler::handleBeingLeaveMessage(MessageIn &msg) void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) { - for (int nb = (msg.getLength() - 2) / (4 + 4 * 2); nb > 0; --nb) + for (int nb = (msg.getLength() - 2) / (2 + 4 * 2); nb > 0; --nb) { - Uint32 id = msg.readLong(); + Uint16 id = msg.readShort(); Being *being = beingManager->findBeing(id); if (!being) continue; int sx = msg.readShort(), sy = msg.readShort(), diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp index d67949cc..4e251524 100644 --- a/src/net/charserverhandler.cpp +++ b/src/net/charserverhandler.cpp @@ -195,7 +195,7 @@ CharServerHandler::handleCharSelectResponse(MessageIn &msg) LocalPlayer* CharServerHandler::readPlayerData(MessageIn &msg, int &slot) { - LocalPlayer *tempPlayer = new LocalPlayer(mLoginData->account_ID, 0, NULL); + LocalPlayer *tempPlayer = new LocalPlayer; slot = msg.readByte(); // character slot tempPlayer->mName = msg.readString(); tempPlayer->setSex(msg.readByte()); diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp index 02f99c41..f765f0f4 100644 --- a/src/net/chathandler.cpp +++ b/src/net/chathandler.cpp @@ -59,12 +59,12 @@ void ChatHandler::handleMessage(MessageIn &msg) { Being *being; std::string chatMsg; - Sint16 chatMsgLength; + //Sint16 chatMsgLength; switch (msg.getId()) { case GPMSG_SAY: - being = beingManager->findBeing(msg.readLong()); + being = beingManager->findBeing(msg.readShort()); chatMsg = msg.readString(); if (being) { @@ -77,6 +77,7 @@ void ChatHandler::handleMessage(MessageIn &msg) } break; + /* // Received speech from being case SMSG_BEING_CHAT: chatMsgLength = msg.readShort() - 8; @@ -131,5 +132,6 @@ void ChatHandler::handleMessage(MessageIn &msg) msg.readLong(); // id chatWindow->chatLog("MVP player", BY_SERVER); break; + */ } } diff --git a/src/net/protocol.h b/src/net/protocol.h index 6feee9d4..f056f003 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -152,13 +152,14 @@ enum { // [, S32 token, S server, W port] PGMSG_PICKUP = 0x0110, GPMSG_PICKUP_RESPONSE = 0x0111, - GPMSG_BEING_ENTER = 0x0200, // B type, L being id + GPMSG_BEING_ENTER = 0x0200, // B type, W being id // player: S name, B hair style, B hair color, B gender - GPMSG_BEING_LEAVE = 0x0201, // B type, L being id + // monster: W type id + GPMSG_BEING_LEAVE = 0x0201, // W being id PGMSG_WALK = 0x0260, // W*2 destination - GPMSG_BEINGS_MOVE = 0x0280, // { L being id, W*2 position, W*2 destination }* + GPMSG_BEINGS_MOVE = 0x0280, // { W being id, W*2 position, W*2 destination }* PGMSG_SAY = 0x02A0, // S text - GPMSG_SAY = 0x02A1, // L being id, S text + GPMSG_SAY = 0x02A1, // W being id, S text PGMSG_USE_ITEM = 0x0300, // L item id GPMSG_USE_RESPONSE = 0x0301, // B error PGMSG_EQUIP = 0x0302, // L item id, B slot diff --git a/src/npc.cpp b/src/npc.cpp index 13025469..b2b426dd 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -33,7 +33,7 @@ extern Spriteset *npcset; NPC *current_npc = 0; -NPC::NPC(Uint32 id, Uint16 job, Map *map): +NPC::NPC(Uint16 id, Uint16 job, Map *map): Being(id, job, map) { mSprites[BASE_SPRITE] = new AnimatedSprite("graphics/sprites/npc.xml", job-100); @@ -29,7 +29,7 @@ class NPC : public Being { public: - NPC(Uint32 id, Uint16 job, Map *map); + NPC(Uint16 id, Uint16 job, Map *map); virtual Type getType() const; diff --git a/src/player.cpp b/src/player.cpp index af9a3344..f5f42e9f 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -32,7 +32,7 @@ #include "gui/gui.h" -Player::Player(Uint32 id, Uint16 job, Map *map): +Player::Player(Uint16 id, Uint16 job, Map *map): Being(id, job, map) { /* Load the weapon sprite. When there are more different weapons this diff --git a/src/player.h b/src/player.h index 65b0303d..6ff4babe 100644 --- a/src/player.h +++ b/src/player.h @@ -38,7 +38,7 @@ class Player : public Being /** * Constructor. */ - Player(Uint32 id, Uint16 job, Map *map); + Player(Uint16 id, Uint16 job, Map *map); virtual Type getType() const; |