summaryrefslogtreecommitdiff
path: root/src/net/equipmenthandler.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-06-12 09:06:01 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-06-12 09:06:01 +0000
commit2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258 (patch)
tree8d256ac1a38932aaf0db7b55ed178e4212616555 /src/net/equipmenthandler.cpp
parenteb019ab915998a3ec247b33dad4b23f763d7a29a (diff)
downloadmana-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.tar.gz
mana-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.tar.bz2
mana-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.tar.xz
mana-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.zip
Merged revisions 3738 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/trunk ........ r3738 | b_lindeijer | 2007-11-16 00:44:01 +0100 (Fri, 16 Nov 2007) | 3 lines Moved item icon from ItemInfo class to the Item class, so that it can be loaded on demand. Results in faster startup time and reduced memory usage. ........
Diffstat (limited to 'src/net/equipmenthandler.cpp')
-rw-r--r--src/net/equipmenthandler.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/net/equipmenthandler.cpp b/src/net/equipmenthandler.cpp
index 69f24d80..85790b42 100644
--- a/src/net/equipmenthandler.cpp
+++ b/src/net/equipmenthandler.cpp
@@ -28,6 +28,7 @@
#include "../beingmanager.h"
#include "../equipment.h"
+#include "../inventory.h"
#include "../item.h"
#include "../localplayer.h"
#include "../log.h"
@@ -54,6 +55,7 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
Sint8 type;
int mask, position;
Item *item;
+ Inventory *inventory = player_node->getInventory();
switch (msg->getId())
{
@@ -73,7 +75,7 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
msg->readInt8(); // refine
msg->skip(8); // card
- player_node->addInvItem(index, itemId, 1, true);
+ inventory->setItem(index, itemId, 1, true);
if (equipPoint)
{
@@ -84,7 +86,7 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
mask <<= 1;
position++;
}
- item = player_node->getInvItem(index);
+ item = inventory->getItem(index);
player_node->mEquipment->setEquipment(position, item);
}
}
@@ -120,7 +122,7 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
item->setEquipped(false);
}
- item = player_node->getInvItem(index);
+ item = inventory->getItem(index);
player_node->mEquipment->setEquipment(position, item);
break;
@@ -146,8 +148,7 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
position++;
}
- item = player_node->getInvItem(index);
-
+ item = inventory->getItem(index);
if (!item)
break;
@@ -181,18 +182,18 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
break;
case SMSG_PLAYER_ARROW_EQUIP:
- itemId = msg->readInt16();
+ index = msg->readInt16();
- if (itemId <= 1)
+ if (index <= 1)
break;
- item = player_node->getInvItem(itemId);
+ item = inventory->getItem(index);
if (!item)
break;
item->setEquipped(true);
player_node->mEquipment->setArrows(item);
- logger->log("Arrows equipped: %i", itemId);
+ logger->log("Arrows equipped: %i", index);
break;
}
}