summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-13 20:50:58 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-13 20:50:58 +0200
commit8c30aafe9a54e4548d3b0817a9f46a536562f3a7 (patch)
tree6b96c8e8d429eede37213645e83dc91bf7c187b5
parent57effc876dba0ef2acc3e6b8d034b394a63d796a (diff)
downloadmv-8c30aafe9a54e4548d3b0817a9f46a536562f3a7.tar.gz
mv-8c30aafe9a54e4548d3b0817a9f46a536562f3a7.tar.bz2
mv-8c30aafe9a54e4548d3b0817a9f46a536562f3a7.tar.xz
mv-8c30aafe9a54e4548d3b0817a9f46a536562f3a7.zip
Fix again equipment window (F4) issue and adding checks.
Now equipment window now worked if was empty inventory in connection movinf to other map.
-rw-r--r--src/net/tmwa/inventoryhandler.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 23a1e78b1..186f9ceb3 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -166,9 +166,12 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
case SMSG_PLAYER_STORAGE_ITEMS:
if (msg.getId() == SMSG_PLAYER_INVENTORY)
{
- // Clear inventory - this will be a complete refresh
- mEquips.clear();
- PlayerInfo::getEquipment()->setBackend(&mEquips);
+ if (PlayerInfo::getEquipment())
+ {
+ // Clear inventory - this will be a complete refresh
+ mEquips.clear();
+ PlayerInfo::getEquipment()->setBackend(&mEquips);
+ }
if (inventory)
inventory->clear();
@@ -255,6 +258,12 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_PLAYER_INVENTORY_ADD:
+ if (PlayerInfo::getEquipment()
+ && !PlayerInfo::getEquipment()->getBackend())
+ { // look like SMSG_PLAYER_INVENTORY was not received
+ mEquips.clear();
+ PlayerInfo::getEquipment()->setBackend(&mEquips);
+ }
index = msg.readInt16() - INVENTORY_OFFSET;
amount = msg.readInt16();
itemId = msg.readInt16();
@@ -426,7 +435,8 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
case SMSG_PLAYER_EQUIPMENT:
msg.readInt16(); // length
- if (!PlayerInfo::getEquipment()->getBackend())
+ if (PlayerInfo::getEquipment()
+ && !PlayerInfo::getEquipment()->getBackend())
{ // look like SMSG_PLAYER_INVENTORY was not received
mEquips.clear();
PlayerInfo::getEquipment()->setBackend(&mEquips);