From fb21f4c16e07bfdb2a3c10aa0e244185f49e424f Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 23 Dec 2009 20:16:47 +0300 Subject: [PATCH] [9050] Add MAX_EXPANSION define for config option Expansion check. This will prevent case when expansion set to high for supported client in config and account have also too high expansion setting. Client in like case receive too high expnasion and reject connection because it think that have not installed expansion for connection account. This possible for example for account case when single realmd used for diff client versions and account have high expansion setting for most recent client support. And in same time mamngos.conf for specific realm have wrong Expansion value. --- src/game/SharedDefines.h | 7 +++++++ src/game/World.cpp | 10 ++++++++-- src/shared/revision_nr.h | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 7f8fe3728..afe7890e2 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2646,4 +2646,11 @@ enum PetTameFailureReason #define EXPECTED_MANGOSD_CLIENT_BUILD {10505, 0} +// max supported expansion level in mangosd +// NOTE: not set it more that supported by targeted client version with all expansions installed +// account with expansion > client supported will rejected at connection by client +// because if client receive unsupported expansion level it think +// that it not have expansion installed and reject +#define MAX_EXPANSION 2 + #endif diff --git a/src/game/World.cpp b/src/game/World.cpp index ad772bdf7..d17426252 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -897,12 +897,18 @@ void World::LoadConfigSettings(bool reload) if(reload) { - uint32 val = sConfig.GetIntDefault("Expansion",1); + uint32 val = sConfig.GetIntDefault("Expansion",MAX_EXPANSION); if(val!=m_configs[CONFIG_EXPANSION]) sLog.outError("Expansion option can't be changed at mangosd.conf reload, using current value (%u).",m_configs[CONFIG_EXPANSION]); } else - m_configs[CONFIG_EXPANSION] = sConfig.GetIntDefault("Expansion",1); + m_configs[CONFIG_EXPANSION] = sConfig.GetIntDefault("Expansion",MAX_EXPANSION); + + if(m_configs[CONFIG_EXPANSION] > MAX_EXPANSION) + { + sLog.outError("Expansion option can't be greater %u but set to %u, used %u",MAX_EXPANSION,m_configs[CONFIG_EXPANSION],MAX_EXPANSION); + m_configs[CONFIG_EXPANSION] = MAX_EXPANSION; + } m_configs[CONFIG_CHATFLOOD_MESSAGE_COUNT] = sConfig.GetIntDefault("ChatFlood.MessageCount",10); m_configs[CONFIG_CHATFLOOD_MESSAGE_DELAY] = sConfig.GetIntDefault("ChatFlood.MessageDelay",1); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e530e3d21..5967b91d9 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 "9049" + #define REVISION_NR "9050" #endif // __REVISION_NR_H__