mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
Core/AuctionHouse: Fix a possible auctionhouse crash
This commit is contained in:
@@ -182,8 +182,10 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||
spellUsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (spellInfo->HasEffect(SPELL_EFFECT_JUMP_DEST))
|
||||
continue; //pets must jump only to target
|
||||
continue; // Pets must only jump to target
|
||||
|
||||
// No enemy, check friendly
|
||||
if (!spellUsed)
|
||||
{
|
||||
@@ -267,6 +269,7 @@ void PetAI::UpdateAllies()
|
||||
//only pet and owner/not in group->ok
|
||||
if (m_AllySet.size() == 2 && !group)
|
||||
return;
|
||||
|
||||
//owner is in group; group members filled in already (no raid -> subgroupcount = whole count)
|
||||
if (group && !group->isRaidGroup() && m_AllySet.size() == (group->GetMembersCount() + 2))
|
||||
return;
|
||||
|
||||
@@ -411,7 +411,7 @@ void AuctionHouseObject::AddAuction(AuctionEntry* auction)
|
||||
sScriptMgr->OnAuctionAdd(this, auction);
|
||||
}
|
||||
|
||||
bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*itemEntry*/)
|
||||
bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction)
|
||||
{
|
||||
bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false;
|
||||
|
||||
@@ -419,6 +419,8 @@ bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*itemEntry
|
||||
|
||||
// we need to delete the entry, it is not referenced any more
|
||||
delete auction;
|
||||
auction = NULL;
|
||||
|
||||
return wasInMap;
|
||||
}
|
||||
|
||||
@@ -465,14 +467,12 @@ void AuctionHouseObject::Update()
|
||||
sScriptMgr->OnAuctionSuccessful(this, auction);
|
||||
}
|
||||
|
||||
uint32 itemEntry = auction->itemEntry;
|
||||
|
||||
///- In any case clear the auction
|
||||
auction->DeleteFromDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
RemoveAuction(auction, itemEntry);
|
||||
sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
|
||||
RemoveAuction(auction);
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class AuctionHouseObject
|
||||
|
||||
void AddAuction(AuctionEntry* auction);
|
||||
|
||||
bool RemoveAuction(AuctionEntry* auction, uint32 itemEntry);
|
||||
bool RemoveAuction(AuctionEntry* auction);
|
||||
|
||||
void Update();
|
||||
|
||||
|
||||
@@ -473,9 +473,8 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
|
||||
auction->DeleteFromDB(trans);
|
||||
|
||||
uint32 itemEntry = auction->itemEntry;
|
||||
sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
|
||||
auctionHouse->RemoveAuction(auction, itemEntry);
|
||||
auctionHouse->RemoveAuction(auction);
|
||||
}
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
@@ -553,9 +552,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
auction->DeleteFromDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
uint32 itemEntry = auction->itemEntry;
|
||||
sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
|
||||
auctionHouse->RemoveAuction(auction, itemEntry);
|
||||
auctionHouse->RemoveAuction(auction);
|
||||
}
|
||||
|
||||
//called when player lists his bids
|
||||
|
||||
Reference in New Issue
Block a user