aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorazazel <none@none>2010-08-09 23:09:36 +0600
committerazazel <none@none>2010-08-09 23:09:36 +0600
commit5643dee52fe635ba4540d6bd6aa91e974a4b4849 (patch)
tree951a5ec0e1c5253e58741281daf5f5efe53a81a3 /src
parent464c0c16116dfd22b3c104165ce6edd7b7f4a3d4 (diff)
Avoid explicit client max level use for selction of bg/arena bracket.
This allows to use brackets like 85-89 existing for some maps (if server allows levels more than 80) (thanks VladimirMangos) --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/server/game/DataStores/DBCStores.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 91e083e6e79..d9d5695cc94 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -808,16 +808,26 @@ MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &di
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)