Ammo Destroy Crash

Old bugs stored here for reference.
Locked
User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Ammo Destroy Crash

Post by thefoof » Mon Oct 21, 2013 2:25 pm

During ranged combat if you have an ammo with a stack_count of 1, fire once the ammo does not disapear from your inventory and you can fire again, however on the second fire the sever crashes in PlayerItemList::DestroyItem().

Code: Select all

Item* item = indexed_items[index];
	map<int16, Item*>::iterator itr;
	if(item && item->IsBag() && item->details.inv_slot_id == 0 && item->details.slot_id < NUM_INV_SLOTS && items.count((sint32)item->details.bag_id) > 0){ //inventory
		map<int16, Item*>* tmp_map = &(items[(sint32)item->details.bag_id]);
		for(itr = tmp_map->begin(); itr != tmp_map->end(); itr++){
			indexed_items[itr->second->details.index] = 0;
			if(itr->second != item){
				safe_delete(itr->second);
			}
		}
		items.erase(item->details.bag_id);
	}
	if(items.count(item->details.inv_slot_id) > 0 && items[item->details.inv_slot_id].count(item->details.slot_id) > 0) <--- arrow here
		items[item->details.inv_slot_id].erase(item->details.slot_id);
EQ2World__Debug.exe!PlayerItemList::DestroyItem(unsigned short index) Line 2380 C++
EQ2World__Debug.exe!Entity::RangeAttack(Spawn * victim, float distance, Item * weapon, Item * ammo, bool multi_attack) Line 274 C++
EQ2World__Debug.exe!Player::ProcessCombat() Line 954 C++
EQ2World__Debug.exe!ZoneServer::CombatProcess() Line 982 C++
EQ2World__Debug.exe!ZoneServer::SpawnProcess() Line 1034 C++
EQ2World__Debug.exe!SpawnLoop(void * tmp) Line 5189 C++
EQ2World__Debug.exe!_callthreadstart() Line 255 C
EQ2World__Debug.exe!_threadstart(void * ptd) Line 239 C
kernel32.dll!@BaseThreadInitThunk@12() Unknown
ntdll.dll!___RtlUserThreadStart@8() Unknown
ntdll.dll!__RtlUserThreadStart@8() Unknown

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Ammo Destroy Crash

Post by Jabantiz » Mon Oct 21, 2013 4:32 pm

oops... ammo is trying to be deleted from the item_list but it is in the equipment_list, this would cause it to stay after you run out and it may possibly be deleting an item from the player inventory. Have a fix for this and will commit it in a min.

Locked

Who is online

Users browsing this forum: No registered users and 0 guests