[Patch] Fix equipping items

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
Rhas
Retired
Posts: 33
Joined: Sat May 29, 2010 11:39 am
Location: Kansas City

[Patch] Fix equipping items

Post by Rhas » 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)
 		{

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: [Patch] Fix equipping items

Post by Scatman » Sun May 30, 2010 12:12 am

Thanks for the submission. I'll put this patch into the code tomorrow, test it, and put it on svn. Thanks for looking into this!

User avatar
Rhas
Retired
Posts: 33
Joined: Sat May 29, 2010 11:39 am
Location: Kansas City

Re: [Patch] Fix equipping items

Post by Rhas » Sun May 30, 2010 12:47 am

No problem! It's been about 5 years since I've touched C++ but I'm still able to follow the code pretty well. I mostly work with .NET now. If you see anything in my code submissions where I'm doing something wrong please let me know. I'm always willing to learn. :D

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: [Patch] Fix equipping items

Post by Scatman » Sun May 30, 2010 2:36 pm

Zcoretri went ahead and applied all three of your diffs. He's checking them in shortly. If you think you'll be doing more code submissions we can set you up with a SVN account so you can check code in. Let us know!

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests