From a1c0cf119768475fe9ff47512ffcb65fc78ac03b Mon Sep 17 00:00:00 2001 From: Tecc Date: Tue, 25 Aug 2026 12:51:47 +0000 Subject: [PATCH] fix(config): clear the item bins before rebuilding them on reload Initialize() runs InitializeFromFile(), InitializeFromSql() and InitializeBins() and never calls Reset(), and ".reload config" goes through Initialize(). InitializeBins() only ever inserts, so on a reload: - items the reloaded configuration or an updated mod_auctionhousebot_disabled_items now excludes stay in the bins and in SellableItems, so an admin who blacklists an item and reloads sees no effect until a full restart - and SellableItems is what gates the price override path against exactly that blacklist; - the *Vec vectors, which are never cleared anywhere, gain a second copy of every item on each reload, skewing the random pick in the rarity tier fallback and growing without bound. Clear all of them at the top of the rebuild. --- src/AuctionHouseBotConfig.cpp | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/AuctionHouseBotConfig.cpp b/src/AuctionHouseBotConfig.cpp index bf7983a..6a39c31 100644 --- a/src/AuctionHouseBotConfig.cpp +++ b/src/AuctionHouseBotConfig.cpp @@ -2667,6 +2667,47 @@ void AHBConfig::InitializeFromSql(std::set botsIds) void AHBConfig::InitializeBins() { + // + // Start from empty containers. Initialize() runs this again on every + // ".reload config" without going through Reset(), so without this the bins + // keep items that the reloaded configuration or blacklist just excluded, + // and the vectors grow by a full copy of themselves on each reload. + // + + GreyTradeGoodsBin.clear(); + WhiteTradeGoodsBin.clear(); + GreenTradeGoodsBin.clear(); + BlueTradeGoodsBin.clear(); + PurpleTradeGoodsBin.clear(); + OrangeTradeGoodsBin.clear(); + YellowTradeGoodsBin.clear(); + + GreyItemsBin.clear(); + WhiteItemsBin.clear(); + GreenItemsBin.clear(); + BlueItemsBin.clear(); + PurpleItemsBin.clear(); + OrangeItemsBin.clear(); + YellowItemsBin.clear(); + + GreyTradeGoodsVec.clear(); + WhiteTradeGoodsVec.clear(); + GreenTradeGoodsVec.clear(); + BlueTradeGoodsVec.clear(); + PurpleTradeGoodsVec.clear(); + OrangeTradeGoodsVec.clear(); + YellowTradeGoodsVec.clear(); + + GreyItemsVec.clear(); + WhiteItemsVec.clear(); + GreenItemsVec.clear(); + BlueItemsVec.clear(); + PurpleItemsVec.clear(); + OrangeItemsVec.clear(); + YellowItemsVec.clear(); + + SellableItems.clear(); + // // Exclude items depending on the configuration; whatever passes all the tests is put in the lists. //