Skip to content

Commit

Permalink
Merge pull request #63 from H0zen/level_fix
Browse files Browse the repository at this point in the history
Fix "Level 0" bug.
  • Loading branch information
H0zen committed Feb 6, 2017
2 parents 848dfdf + e212b94 commit 0cd70c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/game/Object/Creature.cpp
Expand Up @@ -1313,8 +1313,9 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)

SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health));

// all power types
for (int i = POWER_MANA; i <= MAX_POWERS; ++i)
// all power types. WARNING!!! pay great attention to MAX_POWER value
// because you can easily overwrite the UNIT_FIELD_LEVEL
for (int i = POWER_MANA; i < MAX_POWERS; ++i)
{
uint32 maxValue = 0;

Expand All @@ -1325,6 +1326,7 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
case POWER_FOCUS: maxValue = POWER_FOCUS_DEFAULT; break;
case POWER_ENERGY: maxValue = POWER_ENERGY_DEFAULT * cinfo->PowerMultiplier; break;
case POWER_HAPPINESS: maxValue = POWER_HAPPINESS_DEFAULT; break;
default: break; // make compilers happy
}

uint32 value = maxValue;
Expand Down

0 comments on commit 0cd70c2

Please sign in to comment.