resolve circular dependency on uninitialized memory (and add copyrightheaders) in AHBot

(dependency-fix by ge0rg)

--HG--
branch : trunk
This commit is contained in:
click
2010-07-04 20:57:44 +02:00
parent 1416c83394
commit 86df5ec9ad
2 changed files with 42 additions and 3 deletions
@@ -1,10 +1,27 @@
/*
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* 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 "ObjectMgr.h"
#include "AuctionHouseMgr.h" #include "AuctionHouseMgr.h"
#include "AuctionHouseBot.h" #include "AuctionHouseBot.h"
#include <vector> #include <vector>
using namespace std; using namespace std;
vector<uint32> npcItems; vector<uint32> npcItems;
vector<uint32> lootItems; vector<uint32> lootItems;
@@ -22,6 +39,7 @@ vector<uint32> blueItemsBin;
vector<uint32> purpleItemsBin; vector<uint32> purpleItemsBin;
vector<uint32> orangeItemsBin; vector<uint32> orangeItemsBin;
vector<uint32> yellowItemsBin; vector<uint32> yellowItemsBin;
AuctionHouseBot::AuctionHouseBot() AuctionHouseBot::AuctionHouseBot()
{ {
debug_Out = false; debug_Out = false;
@@ -1509,6 +1527,7 @@ void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char*
uint32 maxItems = (uint32) strtoul(param1, NULL, 0); uint32 maxItems = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID); CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID);
config->SetMaxItems(maxItems); config->SetMaxItems(maxItems);
config->CalculatePercents();
} }
break; break;
case 3: //min time Deprecated (Place holder for future commands) case 3: //min time Deprecated (Place holder for future commands)
@@ -1,3 +1,22 @@
/*
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* 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 #ifndef AUCTION_HOUSE_BOT_H
#define AUCTION_HOUSE_BOT_H #define AUCTION_HOUSE_BOT_H
@@ -173,7 +192,8 @@ public:
void SetMaxItems(uint32 value) void SetMaxItems(uint32 value)
{ {
maxItems = value; maxItems = value;
CalculatePercents(); // CalculatePercents() needs to be called, but only if
// SetPercentages() has been called at least once already.
} }
uint32 GetMaxItems() uint32 GetMaxItems()
{ {