From 1a1a541ecf9cede21312318b9604b2c94b772b0a Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 8 Aug 2010 01:40:36 +0400 Subject: [PATCH] [10328] Avoid explcit client max level use for selction bg/arena bracket. This allow use brackets like 85-89 existed for some maps if at server allowed levels > 80. Before like players placed into bracket for level 80 always. --- src/game/DBCStores.cpp | 22 ++++++++++++++++------ src/shared/revision_nr.h | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index aaf0d37e5..5b3d12ee4 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -869,16 +869,26 @@ MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) PvPDifficultyEntry const* GetBattlegroundBracketByLevel( uint32 mapid, uint32 level ) { - // prevent out-of-range levels for dbc data - if (level > DEFAULT_MAX_LEVEL) - level = DEFAULT_MAX_LEVEL; - + PvPDifficultyEntry const* maxEntry = NULL; // used for level > max listed level case for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) + { if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) - if (entry->mapId == mapid && entry->minLevel <= level && entry->maxLevel >= level) + { + // skip unrelated and too-high brackets + if (entry->mapId != mapid || entry->minLevel > level) + continue; + + // exactly fit + if (entry->maxLevel >= level) return entry; - return NULL; + // remember for possible out-of-range case (search higher from existed) + if (!maxEntry || maxEntry->maxLevel < entry->maxLevel) + maxEntry = entry; + } + } + + return maxEntry; } PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattleGroundBracketId id) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 228267ada..408087a55 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 "10327" + #define REVISION_NR "10328" #endif // __REVISION_NR_H__