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.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp
index a8e98860..e452ccf2 100644
--- a/src/net/tmwa/itemhandler.cpp
+++ b/src/net/tmwa/itemhandler.cpp
@@ -21,12 +21,14 @@
#include "net/tmwa/itemhandler.h"
-#include "actorspritemanager.h"
-
#include "net/messagein.h"
#include "net/tmwa/protocol.h"
+#include "actorspritemanager.h"
+#include "game.h"
+#include "map.h"
+
namespace TmwAthena {
ItemHandler::ItemHandler()
@@ -54,7 +56,13 @@ void ItemHandler::handleMessage(Net::MessageIn &msg)
int y = msg.readInt16();
msg.skip(4); // amount,subX,subY / subX,subY,amount
- actorSpriteManager->createItem(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;