Skip to content

Commit

Permalink
[10328] Avoid explcit client max level use for selction bg/arena brac…
Browse files Browse the repository at this point in the history
…ket.

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.
  • Loading branch information
VladimirMangos committed Aug 7, 2010
1 parent 92d2121 commit 913e417
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
22 changes: 16 additions & 6 deletions src/game/DBCStores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10327"
#define REVISION_NR "10328"
#endif // __REVISION_NR_H__

0 comments on commit 913e417

Please sign in to comment.