diff options
| author | Shauren <shauren.trinity@gmail.com> | 2015-07-12 00:41:56 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2015-07-12 00:41:56 +0200 |
| commit | 228b9329259e136bfab281127963e99ec6ff43a0 (patch) | |
| tree | 161ef67262a841f8b34f24823c4a5eddc3ec8569 /src/server/game | |
| parent | f7f7e4d0610c51434387fcd1947cac515db739a5 (diff) | |
Core/Players: Fixed power slot ordering
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/DataStores/DB2Stores.cpp | 12 | ||||
| -rw-r--r-- | src/server/game/DataStores/DB2Stores.h | 4 | ||||
| -rw-r--r-- | src/server/game/DataStores/DB2fmt.h | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/Miscellaneous/SharedDefines.h | 2 |
6 files changed, 20 insertions, 10 deletions
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index a3eb7fed48a..5e9344f10b0 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -287,6 +287,7 @@ void DB2Manager::LoadStores(std::string const& dataPath) for (CharStartOutfitEntry const* outfit : sCharStartOutfitStore) _charStartOutfits[outfit->RaceID | (outfit->ClassID << 8) | (outfit->GenderID << 16)] = outfit; + sChrClassesXPowerTypesStore.Sort(&ChrClassesXPowerTypesEntryComparator::Compare); for (uint32 i = 0; i < MAX_CLASSES; ++i) for (uint32 j = 0; j < MAX_POWERS; ++j) _powersByClass[i][j] = MAX_POWERS; @@ -784,14 +785,21 @@ std::vector<SpellPowerEntry const*> DB2Manager::GetSpellPowers(uint32 spellId, D return powers; } -bool DB2Manager::GlyphSlotEntryComparator::operator()(GlyphSlotEntry const* left, GlyphSlotEntry const* right) const +bool DB2Manager::ChrClassesXPowerTypesEntryComparator::Compare(ChrClassesXPowerTypesEntry const* left, ChrClassesXPowerTypesEntry const* right) +{ + if (left->ClassID != right->ClassID) + return left->ClassID < right->ClassID; + return left->PowerType < right->PowerType; +} + +bool DB2Manager::GlyphSlotEntryComparator::Compare(GlyphSlotEntry const* left, GlyphSlotEntry const* right) { if (left->Tooltip != right->Tooltip) return left->Tooltip < right->Tooltip; return left->Type > right->Type; } -bool DB2Manager::MountTypeXCapabilityEntryComparator::operator()(MountTypeXCapabilityEntry const* left, MountTypeXCapabilityEntry const* right) const +bool DB2Manager::MountTypeXCapabilityEntryComparator::Compare(MountTypeXCapabilityEntry const* left, MountTypeXCapabilityEntry const* right) { if (left->MountTypeID == right->MountTypeID) return left->OrderIndex > right->OrderIndex; diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h index 32b6dc4e989..b99a5f75309 100644 --- a/src/server/game/DataStores/DB2Stores.h +++ b/src/server/game/DataStores/DB2Stores.h @@ -115,12 +115,14 @@ typedef std::vector<HotfixNotify> HotfixData; #define DEFINE_DB2_SET_COMPARATOR(structure) \ struct structure ## Comparator : public std::binary_function<structure const*, structure const*, bool> \ { \ - bool operator()(structure const* left, structure const* right) const; \ + bool operator()(structure const* left, structure const* right) const { return Compare(left, right); } \ + static bool Compare(structure const* left, structure const* right); \ }; class DB2Manager { public: + DEFINE_DB2_SET_COMPARATOR(ChrClassesXPowerTypesEntry); DEFINE_DB2_SET_COMPARATOR(GlyphSlotEntry); DEFINE_DB2_SET_COMPARATOR(MountTypeXCapabilityEntry); diff --git a/src/server/game/DataStores/DB2fmt.h b/src/server/game/DataStores/DB2fmt.h index a7b1e3e7952..b7f3356176e 100644 --- a/src/server/game/DataStores/DB2fmt.h +++ b/src/server/game/DataStores/DB2fmt.h @@ -24,7 +24,7 @@ char const AuctionHouseFormat[] = "niiis"; char const BarberShopStyleFormat[] = "nissfiii"; char const BroadcastTextFormat[] = "nissiiiiiiiii"; char const CharStartOutfitFormat[] = "nbbbbiiiiiiiiiiiiiiiiiiiiiiiiii"; -char const ChrClassesXPowerTypesFormat[] = "nii"; +char const ChrClassesXPowerTypesFormat[] = "iii"; char const CinematicSequencesFormat[] = "niiiiiiiii"; char const CreatureDisplayInfoFormat[] = "niiiffissssiiiiiiiiiii"; char const CreatureTypeFormat[] = "nsi"; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 35f0b92f3f1..82a06801b80 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2414,7 +2414,7 @@ void Player::Regenerate(Powers power) // Skip regeneration for power type we cannot have uint32 powerIndex = GetPowerIndex(power); - if (powerIndex == MAX_POWERS) + if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS) return; float addvalue = 0.0f; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3942853192d..d247e46e595 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11505,7 +11505,7 @@ void Unit::SetMaxHealth(uint32 val) int32 Unit::GetPower(Powers power) const { uint32 powerIndex = GetPowerIndex(power); - if (powerIndex == MAX_POWERS) + if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS) return 0; return GetUInt32Value(UNIT_FIELD_POWER + powerIndex); @@ -11514,7 +11514,7 @@ int32 Unit::GetPower(Powers power) const int32 Unit::GetMaxPower(Powers power) const { uint32 powerIndex = GetPowerIndex(power); - if (powerIndex == MAX_POWERS) + if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS) return 0; return GetInt32Value(UNIT_FIELD_MAXPOWER + powerIndex); @@ -11523,7 +11523,7 @@ int32 Unit::GetMaxPower(Powers power) const void Unit::SetPower(Powers power, int32 val) { uint32 powerIndex = GetPowerIndex(power); - if (powerIndex == MAX_POWERS) + if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS) return; int32 maxPower = int32(GetMaxPower(power)); @@ -11557,7 +11557,7 @@ void Unit::SetPower(Powers power, int32 val) void Unit::SetMaxPower(Powers power, int32 val) { uint32 powerIndex = GetPowerIndex(power); - if (powerIndex == MAX_POWERS) + if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS) return; int32 cur_power = GetPower(power); diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index f04f7b537dd..d767f88e102 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -267,7 +267,7 @@ enum Powers // (6.0) POWER_HEALTH = 0xFFFFFFFE // (-2 as signed value) }; -#define MAX_POWERS_PER_CLASS 5 +#define MAX_POWERS_PER_CLASS 6 enum SpellSchools : uint16 { |
