diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 934d124d8..36f0efe2b 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -159,6 +159,25 @@ DBCStorage sWorldSafeLocsStore(WorldSafeLocsEntryfmt); typedef std::list StoreProblemList; +bool IsAcceptableClientBuild(uint32 build) +{ + int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD; + for(int i = 0; accepted_versions[i]; ++i) + if(build == accepted_versions[i]) + return true; + + return false; +} + +std::string AcceptableClientBuildsListStr() +{ + std::ostringstream data; + int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD; + for(int i = 0; accepted_versions[i]; ++i) + data << accepted_versions[i] << " "; + return data.str(); +} + static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, const std::string& filename) { sLog.outError("ERROR: Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).",filename.c_str(),fsize,rsize); @@ -513,7 +532,7 @@ void LoadDBCStores(const std::string& dataPath) !sAreaStore.LookupEntry(2905) || // last area (areaflag) added in 3.1.3 !sItemStore.LookupEntry(46894) ) // last client known item added in 3.1.3 { - sLog.outError("\nYou have _outdated_ DBC files. Please extract correct versions from current using client."); + sLog.outError("\nYou have _outdated_ DBC files. Please re-extract DBC files for one from client build: %s",AcceptableClientBuildsListStr().c_str()); exit(1); } diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index d4ff85467..b18768105 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -25,6 +25,9 @@ #include +bool IsAcceptableClientBuild(uint32 build); +std::string AcceptableClientBuildsListStr(); + typedef std::list SimpleFactionsList; SimpleFactionsList const* GetFactionTeamList(uint32 faction); diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index a818b618b..8f821e3aa 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -42,6 +42,7 @@ #include "WorldSession.h" #include "WorldSocketMgr.h" #include "Log.h" +#include "DBCStores.h" #if defined( __GNUC__ ) #pragma pack(1) @@ -761,18 +762,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) clientSeed); // Check the version of client trying to connect - bool valid_version = false; - int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD; - for(int i = 0; accepted_versions[i]; ++i) - { - if(ClientBuild == accepted_versions[i]) - { - valid_version = true; - break; - } - } - - if(!valid_version) + if(!IsAcceptableClientBuild(ClientBuild)) { packet.Initialize (SMSG_AUTH_RESPONSE, 1); packet << uint8 (AUTH_VERSION_MISMATCH); diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index 867fe5d83..10ad94862 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -229,13 +229,9 @@ int Master::Run() // set realmbuilds depend on mangosd expected builds, and set server online { - std::ostringstream data; - int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD; - for(int i = 0; accepted_versions[i]; ++i) - { - data << accepted_versions[i] << " "; - } - loginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0, realmbuilds = '%s' WHERE id = '%d'", data.str().c_str(), realmID); + std::string builds = AcceptableClientBuildsListStr(); + loginDatabase.escape_string(builds); + loginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0, realmbuilds = '%s' WHERE id = '%d'", builds.c_str(), realmID); } ACE_Based::Thread* cliThread = NULL; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b601c8e43..02a78bba4 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 "9168" + #define REVISION_NR "9169" #endif // __REVISION_NR_H__