diff options
author | Aaron Marks <nymacro@gmail.com> | 2005-11-10 10:00:29 +0000 |
---|---|---|
committer | Aaron Marks <nymacro@gmail.com> | 2005-11-10 10:00:29 +0000 |
commit | e86de3e7ce09660e615792dba50af9de5d2d82c5 (patch) | |
tree | 8d2ac25779095112960a2521e9046cffefda03bd /src/gamehandler.cpp | |
parent | a13d9f0066aabc966fa6d60951b178bf73dc0f1b (diff) | |
download | manaserv-e86de3e7ce09660e615792dba50af9de5d2d82c5.tar.gz manaserv-e86de3e7ce09660e615792dba50af9de5d2d82c5.tar.bz2 manaserv-e86de3e7ce09660e615792dba50af9de5d2d82c5.tar.xz manaserv-e86de3e7ce09660e615792dba50af9de5d2d82c5.zip |
Updates to Being, test client, game handler and small update to state update.
Diffstat (limited to 'src/gamehandler.cpp')
-rw-r--r-- | src/gamehandler.cpp | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/gamehandler.cpp b/src/gamehandler.cpp index cfeda536..7d525b5f 100644 --- a/src/gamehandler.cpp +++ b/src/gamehandler.cpp @@ -46,28 +46,33 @@ void GameHandler::receiveMessage(NetComputer &computer, MessageIn &message) result.writeShort(SMSG_PICKUP_RESPONSE); result.writeByte(PICKUP_OK); } break; - + + case CMSG_USE_ITEM: case CMSG_USE_OBJECT: { unsigned int itemId = message.readLong(); - // use item - // this should execute a script which will do the appropriate action - - // respond result.writeShort(SMSG_USE_RESPONSE); - result.writeByte(USE_OK); + + if (computer.getCharacter()->hasItem(itemId)) { + // use item + // this should execute a script which will do the appropriate action + // (the script will determine if the item is 1 use only) + result.writeByte(USE_OK); + } else { + result.writeByte(USE_FAIL); + } } break; case CMSG_TARGET: { - + // nothing at the moment } break; case CMSG_WALK: { - int x = message.readLong(); - int y = message.readLong(); + long x = message.readLong(); + long y = message.readLong(); // simplistic "teleport" walk computer.getCharacter()->setX(x); @@ -77,16 +82,19 @@ void GameHandler::receiveMessage(NetComputer &computer, MessageIn &message) } break; case CMSG_START_TRADE: - break; + { + // nothing at the moment + } break; case CMSG_START_TALK: - break; + { + // nothing at the moment + } break; case CMSG_REQ_TRADE: - break; - - case CMSG_USE_ITEM: - break; + { + // nothing at the moment + } break; case CMSG_EQUIP: { |