mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Fix clang/gcc linking
This commit is contained in:
@@ -3510,13 +3510,13 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint64 raceMask = fields[0].GetUInt64();
|
||||
Trinity::RaceMask<uint64> raceMask = { fields[0].GetUInt64() };
|
||||
uint32 classMask = fields[1].GetUInt32();
|
||||
uint32 spellId = fields[2].GetUInt32();
|
||||
|
||||
if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE))
|
||||
if (raceMask && !(raceMask.RawValue & RACEMASK_ALL_PLAYABLE))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Wrong race mask " UI64FMTD " in `playercreateinfo_cast_spell` table, ignoring.", raceMask);
|
||||
TC_LOG_ERROR("sql.sql", "Wrong race mask " UI64FMTD " in `playercreateinfo_cast_spell` table, ignoring.", raceMask.RawValue);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3528,7 +3528,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
|
||||
for (uint32 raceIndex = RACE_HUMAN; raceIndex < MAX_RACES; ++raceIndex)
|
||||
{
|
||||
if (raceMask == 0 || ((UI64LIT(1) << (raceIndex - 1)) & raceMask))
|
||||
if (!raceMask || raceMask.HasRace(raceIndex))
|
||||
{
|
||||
for (uint32 classIndex = CLASS_WARRIOR; classIndex < MAX_CLASSES; ++classIndex)
|
||||
{
|
||||
|
||||
@@ -77,32 +77,28 @@ struct RaceMask
|
||||
|
||||
constexpr bool HasRace(uint8 raceId) const
|
||||
{
|
||||
if (raceId >= MAX_RACES || raceBits[raceId] < 0 || raceBits[raceId] >= 64)
|
||||
return false;
|
||||
|
||||
return (RawValue & (T(1) << raceBits[raceId])) != 0;
|
||||
return (RawValue & GetMaskForRace(raceId)) != 0;
|
||||
}
|
||||
|
||||
static constexpr T GetMaskForRace(uint8 raceId)
|
||||
{
|
||||
return raceId < MAX_RACES ? (T(1) << raceBits[raceId]) : T(0);
|
||||
constexpr int32 raceBits[MAX_RACES] =
|
||||
{
|
||||
0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, 21, -1, 23, 24, 25, 26, 27, 28,
|
||||
29, 30, 31, -1, 11, 12, 13, 14
|
||||
};
|
||||
return raceId < MAX_RACES && raceBits[raceId] >= 0 && raceBits[raceId] < 64 ? (T(1) << raceBits[raceId]) : T(0);
|
||||
}
|
||||
|
||||
constexpr operator bool() const { return RawValue != T(0); }
|
||||
constexpr bool operator!() const { return !operator bool(); }
|
||||
|
||||
private:
|
||||
static constexpr int32 raceBits[MAX_RACES] =
|
||||
{
|
||||
0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, 21, -1, 23, 24, 25, 26, 27, 28,
|
||||
29, 30, 31, -1, 11, 12, 13, 14
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
constexpr uint64 RACEMASK_ALL_PLAYABLE =
|
||||
constexpr uint64 RACEMASK_ALL_PLAYABLE = std::integral_constant<uint64,
|
||||
// force compile time evaluation via integral_constant
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_HUMAN) |
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_ORC) |
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_DWARF) |
|
||||
@@ -127,11 +123,11 @@ constexpr uint64 RACEMASK_ALL_PLAYABLE =
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_DARK_IRON_DWARF) |
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_VULPERA) |
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_MAGHAR_ORC) |
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_MECHAGNOME);
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_MECHAGNOME)>::value;
|
||||
|
||||
constexpr uint64 RACEMASK_NEUTRAL = Trinity::RaceMask<uint64>::GetMaskForRace(RACE_PANDAREN_NEUTRAL);
|
||||
constexpr uint64 RACEMASK_NEUTRAL = std::integral_constant<uint64, Trinity::RaceMask<uint64>::GetMaskForRace(RACE_PANDAREN_NEUTRAL)>::value;
|
||||
|
||||
constexpr uint64 RACEMASK_ALLIANCE =
|
||||
constexpr uint64 RACEMASK_ALLIANCE = std::integral_constant<uint64,
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_HUMAN) |
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_DWARF) |
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_NIGHTELF) |
|
||||
@@ -143,8 +139,8 @@ constexpr uint64 RACEMASK_ALLIANCE =
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_LIGHTFORGED_DRAENEI) |
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_KUL_TIRAN) |
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_DARK_IRON_DWARF) |
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_MECHAGNOME);
|
||||
Trinity::RaceMask<uint64>::GetMaskForRace(RACE_MECHAGNOME)>::value;
|
||||
|
||||
constexpr uint64 RACEMASK_HORDE = RACEMASK_ALL_PLAYABLE & ~(RACEMASK_NEUTRAL | RACEMASK_ALLIANCE);
|
||||
constexpr uint64 RACEMASK_HORDE = std::integral_constant<uint64, RACEMASK_ALL_PLAYABLE & ~(RACEMASK_NEUTRAL | RACEMASK_ALLIANCE)>::value;
|
||||
|
||||
#endif // RaceMask_h__
|
||||
|
||||
Reference in New Issue
Block a user