From 5310a7a0ea99bc79bec06c27cd0b06ce2ede8f39 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 7 Aug 2011 00:19:29 +0400 Subject: [PATCH] [11769] Fixed auction ordering functions assert fails. This fix problem when by same order case left/right auction greater each other in same time. This possible in old code because selection way compare for case dependent only from one from compared auction so it can be true/false for left/right. --- src/game/AuctionHouseMgr.cpp | 42 ++++++++++++++++-------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index ba6469e79..ba7879de6 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -668,7 +668,7 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry *auc, Pl break; } case 2: // buyoutthenbid = 2 - if (buyout) + if (buyout != auc->buyout) { if (buyout < auc->buyout) return -1; @@ -716,18 +716,15 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry *auc, Pl return wname1.compare(wname2); } case 6: // minbidbuyout = 6 - if (bid) + { + uint32 bid1 = bid ? bid : startbid; + uint32 bid2 = auc->bid ? auc->bid : auc->startbid; + + if (bid1 != bid2) { - if (bid < auc->bid) + if (bid1 < bid2) return -1; - else if (bid > auc->bid) - return +1; - } - else if (startbid) - { - if (startbid < auc->startbid) - return -1; - else if (startbid > auc->startbid) + else if (bid1 > bid2) return +1; } else @@ -737,25 +734,22 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry *auc, Pl else if (buyout > auc->buyout) return +1; } + break; + } case 7: // seller = 7 return ownerName.compare(auc->ownerName); case 8: // bid = 8 - if (bid) - { - if (bid < auc->bid) - return -1; - else if (bid > auc->bid) + { + uint32 bid1 = bid ? bid : startbid; + uint32 bid2 = auc->bid ? auc->bid : auc->startbid; + + if (bid1 < bid2) + return -1; + else if (bid1 > bid2) return +1; - } - else - { - if (startbid < auc->startbid) - return -1; - else if (startbid > auc->startbid) - return +1; - } break; + } case 9: // quantity = 9 { if (itemCount < auc->itemCount) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7a5582a9c..b26ef6de3 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11768" + #define REVISION_NR "11769" #endif // __REVISION_NR_H__