From 86df5ec9ad6e2269f8eb0a190352d536bb275511 Mon Sep 17 00:00:00 2001 From: click Date: Sun, 4 Jul 2010 20:57:44 +0200 Subject: resolve circular dependency on uninitialized memory (and add copyrightheaders) in AHBot (dependency-fix by ge0rg) --HG-- branch : trunk --- .../AuctionHouseBot/AuctionHouseBot.cpp | 23 ++++++++++++++++++++-- .../AuctionHouse/AuctionHouseBot/AuctionHouseBot.h | 22 ++++++++++++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp b/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp index ce621e689cd..0a4b6c3f32e 100644 --- a/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp @@ -1,10 +1,27 @@ +/* + * Copyright (C) 2008-2010 Trinity + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "ObjectMgr.h" #include "AuctionHouseMgr.h" #include "AuctionHouseBot.h" #include - - using namespace std; vector npcItems; vector lootItems; @@ -22,6 +39,7 @@ vector blueItemsBin; vector purpleItemsBin; vector orangeItemsBin; vector yellowItemsBin; + AuctionHouseBot::AuctionHouseBot() { debug_Out = false; @@ -1509,6 +1527,7 @@ void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char* uint32 maxItems = (uint32) strtoul(param1, NULL, 0); CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID); config->SetMaxItems(maxItems); + config->CalculatePercents(); } break; case 3: //min time Deprecated (Place holder for future commands) diff --git a/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.h b/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.h index 853955a43a0..d1cec5f170e 100644 --- a/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.h +++ b/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.h @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2008-2010 Trinity + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef AUCTION_HOUSE_BOT_H #define AUCTION_HOUSE_BOT_H @@ -173,7 +192,8 @@ public: void SetMaxItems(uint32 value) { maxItems = value; - CalculatePercents(); + // CalculatePercents() needs to be called, but only if + // SetPercentages() has been called at least once already. } uint32 GetMaxItems() { -- cgit v1.2.3