summaryrefslogtreecommitdiff
path: root/src/net/tmwa/itemhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa/itemhandler.cpp')
-rw-r--r--src/net/tmwa/itemhandler.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp
index abc8103b..9f303617 100644
--- a/src/net/tmwa/itemhandler.cpp
+++ b/src/net/tmwa/itemhandler.cpp
@@ -21,17 +21,19 @@
#include "net/tmwa/itemhandler.h"
-#include "flooritemmanager.h"
-
#include "net/messagein.h"
#include "net/tmwa/protocol.h"
+#include "actorspritemanager.h"
+#include "game.h"
+#include "map.h"
+
namespace TmwAthena {
ItemHandler::ItemHandler()
{
- static const Uint16 _messages[] = {
+ static const uint16_t _messages[] = {
SMSG_ITEM_VISIBLE,
SMSG_ITEM_DROPPED,
SMSG_ITEM_REMOVE,
@@ -54,13 +56,19 @@ void ItemHandler::handleMessage(Net::MessageIn &msg)
int y = msg.readInt16();
msg.skip(4); // amount,subX,subY / subX,subY,amount
- floorItemManager->create(id, itemId, x, y);
+ Game *game = Game::instance();
+ if (!game)
+ break;
+
+ if (Map *map = game->getCurrentMap())
+ actorSpriteManager->createItem(id, itemId,
+ map->getTileCenter(x, y));
}
break;
case SMSG_ITEM_REMOVE:
- if (FloorItem *item = floorItemManager->findById(msg.readInt32()))
- floorItemManager->destroy(item);
+ if (FloorItem *item = actorSpriteManager->findItem(msg.readInt32()))
+ actorSpriteManager->destroy(item);
break;
}
}