diff --git a/src/game/AuctionHouseBot/AuctionHouseBot.cpp b/src/game/AuctionHouseBot/AuctionHouseBot.cpp index 82030d412..0cc6703cb 100644 --- a/src/game/AuctionHouseBot/AuctionHouseBot.cpp +++ b/src/game/AuctionHouseBot/AuctionHouseBot.cpp @@ -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(); diff --git a/src/game/AuctionHouseBot/AuctionHouseBot.h b/src/game/AuctionHouseBot/AuctionHouseBot.h index 936804439..61a8316ab 100644 --- a/src/game/AuctionHouseBot/AuctionHouseBot.h +++ b/src/game/AuctionHouseBot/AuctionHouseBot.h @@ -107,8 +107,9 @@ enum AuctionBotConfigBoolValues class AuctionBotConfig { public: - AuctionBotConfig() {} + AuctionBotConfig(); + void SetConfigFileName(char const* filename) { m_configFileName = filename; } bool Initialize(); const char* GetAHBotIncludes() const { return m_AHBotIncludes.c_str(); } const char* GetAHBotExcludes() const { return m_AHBotExcludes.c_str(); } @@ -131,6 +132,7 @@ class AuctionBotConfig static char const* GetHouseTypeName(AuctionHouseType houseType); private: + std::string m_configFileName; std::string m_AHBotIncludes; std::string m_AHBotExcludes; Config m_AhBotCfg; diff --git a/src/mangosd/Main.cpp b/src/mangosd/Main.cpp index 62f7166ca..483168475 100644 --- a/src/mangosd/Main.cpp +++ b/src/mangosd/Main.cpp @@ -27,6 +27,7 @@ #include "Log.h" #include "Master.h" #include "SystemConfig.h" +#include "AuctionHouseBot/AuctionHouseBot.h" #include "revision.h" #include "revision_nr.h" #include @@ -62,6 +63,7 @@ void usage(const char *prog) sLog.outString("Usage: \n %s []\n" " -v, --version print version and exist\n\r" " -c config_file use config_file as configuration file\n\r" + " -a, --ahbot config_file use config_file as ahbot configuration file\n\r" #ifdef WIN32 " Running as service functions:\n\r" " -s run run as service\n\r" @@ -82,10 +84,11 @@ extern int main(int argc, char **argv) char const* cfg_file = _MANGOSD_CONFIG; - char const *options = ":c:s:"; + char const *options = ":a:c:s:"; ACE_Get_Opt cmd_opts(argc, argv, options); - cmd_opts.long_option("version", 'v'); + cmd_opts.long_option("version", 'v', ACE_Get_Opt::NO_ARG); + cmd_opts.long_option("ahbot", 'a', ACE_Get_Opt::ARG_REQUIRED); char serviceDaemonMode = '\0'; @@ -94,6 +97,9 @@ extern int main(int argc, char **argv) { switch (option) { + case 'a': + sAuctionBotConfig.SetConfigFileName(cmd_opts.opt_arg()); + break; case 'c': cfg_file = cmd_opts.opt_arg(); break; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f57c65803..15bdedd17 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 "11750" + #define REVISION_NR "11751" #endif // __REVISION_NR_H__