aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Realm
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/shared/Realm')
-rw-r--r--src/server/shared/Realm/RealmList.cpp62
-rw-r--r--src/server/shared/Realm/RealmList.h1
2 files changed, 37 insertions, 26 deletions
diff --git a/src/server/shared/Realm/RealmList.cpp b/src/server/shared/Realm/RealmList.cpp
index 49dac39cef5..9babd0eeec1 100644
--- a/src/server/shared/Realm/RealmList.cpp
+++ b/src/server/shared/Realm/RealmList.cpp
@@ -204,38 +204,48 @@ Realm const* RealmList::GetRealm(Battlenet::RealmHandle const& id) const
return NULL;
}
+// List of client builds for verbose version info in realmlist packet
+static RealmBuildInfo const ClientBuilds[] =
+{
+ { 28938, 8, 1, 5, ' ' },
+ { 21355, 6, 2, 4, ' ' },
+ { 20726, 6, 2, 3, ' ' },
+ { 20574, 6, 2, 2, 'a' },
+ { 20490, 6, 2, 2, 'a' },
+ { 15595, 4, 3, 4, ' ' },
+ { 14545, 4, 2, 2, ' ' },
+ { 13623, 4, 0, 6, 'a' },
+ { 13930, 3, 3, 5, 'a' }, // 3.3.5a China Mainland build
+ { 12340, 3, 3, 5, 'a' },
+ { 11723, 3, 3, 3, 'a' },
+ { 11403, 3, 3, 2, ' ' },
+ { 11159, 3, 3, 0, 'a' },
+ { 10505, 3, 2, 2, 'a' },
+ { 9947, 3, 1, 3, ' ' },
+ { 8606, 2, 4, 3, ' ' },
+ { 6141, 1, 12, 3, ' ' },
+ { 6005, 1, 12, 2, ' ' },
+ { 5875, 1, 12, 1, ' ' },
+};
+
RealmBuildInfo const* RealmList::GetBuildInfo(uint32 build) const
{
- // List of client builds for verbose version info in realmlist packet
- static std::vector<RealmBuildInfo> const ClientBuilds =
- {
- { 21355, 6, 2, 4, ' ' },
- { 20726, 6, 2, 3, ' ' },
- { 20574, 6, 2, 2, 'a' },
- { 20490, 6, 2, 2, 'a' },
- { 15595, 4, 3, 4, ' ' },
- { 14545, 4, 2, 2, ' ' },
- { 13623, 4, 0, 6, 'a' },
- { 13930, 3, 3, 5, 'a' }, // 3.3.5a China Mainland build
- { 12340, 3, 3, 5, 'a' },
- { 11723, 3, 3, 3, 'a' },
- { 11403, 3, 3, 2, ' ' },
- { 11159, 3, 3, 0, 'a' },
- { 10505, 3, 2, 2, 'a' },
- { 9947, 3, 1, 3, ' ' },
- { 8606, 2, 4, 3, ' ' },
- { 6141, 1, 12, 3, ' ' },
- { 6005, 1, 12, 2, ' ' },
- { 5875, 1, 12, 1, ' ' },
- };
-
- for (std::size_t i = 0; i < ClientBuilds.size(); ++i)
- if (ClientBuilds[i].Build == build)
- return &ClientBuilds[i];
+ for (RealmBuildInfo const& clientBuild : ClientBuilds)
+ if (clientBuild.Build == build)
+ return &clientBuild;
return nullptr;
}
+uint32 RealmList::GetMinorMajorBugfixVersionForBuild(uint32 build) const
+{
+ RealmBuildInfo const* buildInfo = std::lower_bound(std::begin(ClientBuilds), std::end(ClientBuilds), build, [](RealmBuildInfo const& buildInfo, uint32 value)
+ {
+ return buildInfo.Build < value;
+ });
+ return buildInfo != std::end(ClientBuilds) ? (buildInfo->MajorVersion * 10000 + buildInfo->MinorVersion * 100 + buildInfo->BugfixVersion) : 0;
+}
+
void RealmList::WriteSubRegions(bgs::protocol::game_utilities::v1::GetAllValuesForAttributeResponse* response) const
{
boost::shared_lock<boost::shared_mutex> lock(*_realmsMutex);
diff --git a/src/server/shared/Realm/RealmList.h b/src/server/shared/Realm/RealmList.h
index 2bacdf308ee..da1a6b2c4e8 100644
--- a/src/server/shared/Realm/RealmList.h
+++ b/src/server/shared/Realm/RealmList.h
@@ -92,6 +92,7 @@ public:
Realm const* GetRealm(Battlenet::RealmHandle const& id) const;
RealmBuildInfo const* GetBuildInfo(uint32 build) const;
+ uint32 GetMinorMajorBugfixVersionForBuild(uint32 build) const;
void WriteSubRegions(bgs::protocol::game_utilities::v1::GetAllValuesForAttributeResponse* response) const;
std::vector<uint8> GetRealmEntryJSON(Battlenet::RealmHandle const& id, uint32 build) const;
std::vector<uint8> GetRealmList(uint32 build, std::string const& subRegion) const;