[11751] Implement option for set ahbot config file in mangosd command line

"-a configfilename" or "--ahbot configfilename" can be used for this

This possibility can be useful if normal mangosd.conf path also set by -c
option for example.
This commit is contained in:
VladimirMangos 2011-07-24 08:23:10 +04:00
parent b26a969e0d
commit f07a3232d4
4 changed files with 19 additions and 8 deletions

View file

@ -211,19 +211,22 @@ INSTANTIATE_SINGLETON_1( AuctionBotConfig );
//== AuctionBotConfig functions ============================
AuctionBotConfig::AuctionBotConfig() : m_configFileName(_AUCTIONHOUSEBOT_CONFIG)
{
}
bool AuctionBotConfig::Initialize()
{
char const* cfg_file = _AUCTIONHOUSEBOT_CONFIG;
if (!m_AhBotCfg.SetSource(cfg_file))
if (!m_AhBotCfg.SetSource(m_configFileName.c_str()))
{
sLog.outString("AHBOT is Disabled. Unable to open configuration file(%s). ", _AUCTIONHOUSEBOT_CONFIG);
sLog.outString("AHBOT is Disabled. Unable to open configuration file(%s). ", m_configFileName.c_str());
setConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO, 0);
setConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO, 0);
setConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO, 0);
return false;
}
else
sLog.outString("AHBot using configuration file %s",_AUCTIONHOUSEBOT_CONFIG);
sLog.outString("AHBot using configuration file %s", m_configFileName.c_str());
GetConfigFromFile();