Finally fix UnitMods and add more assertions.

This commit is contained in:
LordJZ 2012-08-12 08:49:30 +04:00 committed by Antz
parent a5ca883668
commit 9bfd741583
3 changed files with 10 additions and 5 deletions

View file

@ -16158,7 +16158,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
uint32 savedhealth = fields[50].GetUInt32();
SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);
for(uint32 i = 0; i < MAX_STORED_POWERS; ++i)
static_assert(MAX_STORED_POWERS == 5, "Query not updated.");
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
{
uint32 savedpower = fields[51 + i].GetUInt32();
SetPowerByIndex(i, std::min(savedpower, GetMaxPowerByIndex(i)));
@ -17592,6 +17593,7 @@ void Player::SaveToDB()
uberInsert.addUInt32(GetHealth());
static_assert(MAX_STORED_POWERS == 5, "Query not updated.");
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
uberInsert.addUInt32(GetPowerByIndex(i));
@ -18267,7 +18269,8 @@ void Player::_SaveStats()
stmt.addUInt32(GetGUIDLow());
stmt.addUInt32(GetMaxHealth());
for (int i = 0; i < MAX_STORED_POWERS; ++i)
static_assert(MAX_STORED_POWERS == 5, "Query not updated.");
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
stmt.addUInt32(GetMaxPowerByIndex(i));
for (int i = 0; i < MAX_STATS; ++i)
stmt.addFloat(GetStat(Stats(i)));