mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-25 16:52:25 +00:00
Fix overflow issue with character corpse creation using the wrong struct in allocation
This commit is contained in:
parent
b57bcced40
commit
51356610b2
@ -621,7 +621,7 @@ bool Corpse::Save() {
|
|||||||
end = itemlist.end();
|
end = itemlist.end();
|
||||||
for (; cur != end; ++cur) {
|
for (; cur != end; ++cur) {
|
||||||
ServerLootItem_Struct* item = *cur;
|
ServerLootItem_Struct* item = *cur;
|
||||||
memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct));
|
memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(player_lootitem::ServerLootItem_Struct));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create New Corpse*/
|
/* Create New Corpse*/
|
||||||
|
|||||||
@ -523,22 +523,37 @@ void NPC::AddLootDrop(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NPC::AddItem(const EQ::ItemData* item, uint16 charges, bool equipitem) {
|
void NPC::AddItem(const EQ::ItemData *item, uint16 charges, bool equipitem)
|
||||||
|
{
|
||||||
//slot isnt needed, its determined from the item.
|
//slot isnt needed, its determined from the item.
|
||||||
auto loot_drop_entry = NPC::NewLootDropEntry();
|
auto loot_drop_entry = NPC::NewLootDropEntry();
|
||||||
loot_drop_entry.equip_item = static_cast<uint8>(equipitem ? 1 : 0);
|
loot_drop_entry.equip_item = static_cast<uint8>(equipitem ? 1 : 0);
|
||||||
|
loot_drop_entry.item_charges = charges;
|
||||||
|
|
||||||
AddLootDrop(item, &itemlist, loot_drop_entry, true);
|
AddLootDrop(item, &itemlist, loot_drop_entry, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NPC::AddItem(uint32 itemid, uint16 charges, bool equipitem, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6) {
|
void NPC::AddItem(
|
||||||
|
uint32 itemid,
|
||||||
|
uint16 charges,
|
||||||
|
bool equipitem,
|
||||||
|
uint32 aug1,
|
||||||
|
uint32 aug2,
|
||||||
|
uint32 aug3,
|
||||||
|
uint32 aug4,
|
||||||
|
uint32 aug5,
|
||||||
|
uint32 aug6
|
||||||
|
)
|
||||||
|
{
|
||||||
//slot isnt needed, its determined from the item.
|
//slot isnt needed, its determined from the item.
|
||||||
const EQ::ItemData * i = database.GetItem(itemid);
|
const EQ::ItemData *i = database.GetItem(itemid);
|
||||||
if(i == nullptr)
|
if (i == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto loot_drop_entry = NPC::NewLootDropEntry();
|
auto loot_drop_entry = NPC::NewLootDropEntry();
|
||||||
loot_drop_entry.equip_item = static_cast<uint8>(equipitem ? 1 : 0);
|
loot_drop_entry.equip_item = static_cast<uint8>(equipitem ? 1 : 0);
|
||||||
|
loot_drop_entry.item_charges = charges;
|
||||||
|
|
||||||
AddLootDrop(i, &itemlist, loot_drop_entry, true, aug1, aug2, aug3, aug4, aug5, aug6);
|
AddLootDrop(i, &itemlist, loot_drop_entry, true, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user