[Patch] Fix equipping items
Posted: Sat May 29, 2010 11:55 pm
On revision 437 I am able to equip an item into any slot (weapon on head, etc). This small bit of code fixes it so if you try to equip an item in an invalid slot it does nothing and leaves the item in your inventory. Auto-equipping (drag to avatar or double-click item) still works. I tested this on my server (latest HEAD with only this change) and also went to another public server to verify the bug still existed. Client version tested was 6118L.
Code: Select all
--- Player.cpp (Revision 437)
+++ Player.cpp (Working Copy)
@@ -953,8 +953,10 @@
return packets;
Item* item = item_list.indexed_items[index];
if(item){
- int8 slot = equipment_list.GetFreeSlot(item, slot_id);
+ if(slot_id != 255 && !item->HasSlot(slot_id))
+ return packets;
+ int8 slot = equipment_list.GetFreeSlot(item, slot_id);
bool canEquip = CanEquipItem(item);
if(canEquip && slot == 255)
{