Some code cleanup.

This commit is contained in:
H0zen 2017-06-06 02:41:26 +03:00 committed by Antz
parent d5f638b8c8
commit 65229fcf4e
32 changed files with 107 additions and 91 deletions

View file

@ -232,16 +232,16 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket & /*recv_
{ {
case BATTLEGROUND_WS: case BATTLEGROUND_WS:
{ {
if (flagCarrierA = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagCarrierGuid())) if ((flagCarrierA = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagCarrierGuid())))
++flagCarrierCountH; ++flagCarrierCountH;
if (flagCarrierH = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagCarrierGuid())) if ((flagCarrierH = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagCarrierGuid())))
++flagCarrierCountH; ++flagCarrierCountH;
break; break;
} }
case BATTLEGROUND_EY: case BATTLEGROUND_EY:
{ {
if (flagCarrierH = sObjectMgr.GetPlayer(((BattleGroundEY*)bg)->GetFlagCarrierGuid())) if ((flagCarrierH = sObjectMgr.GetPlayer(((BattleGroundEY*)bg)->GetFlagCarrierGuid())))
++flagCarrierCountH; ++flagCarrierCountH;
break; break;
} }

View file

@ -21,6 +21,11 @@ set(LIBRARY_NAME game)
add_definitions(-DDT_POLYREF64) add_definitions(-DDT_POLYREF64)
set(game_PCH "${CMAKE_CURRENT_SOURCE_DIR}/pchdef.h")
if(PCH)
LIST(APPEND game_PCH "${CMAKE_CURRENT_SOURCE_DIR}/pchdef.cpp")
endif()
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouseBot ${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouseBot
@ -135,16 +140,16 @@ set(LIBRARY_SRCS
${SRC_GRP_WARDEN} ${SRC_GRP_WARDEN}
${SRC_GRP_WARDEN_MODULES} ${SRC_GRP_WARDEN_MODULES}
${SRC_GRP_WORLD_HANDLERS} ${SRC_GRP_WORLD_HANDLERS}
pchdef.cpp ${game_PCH}
pchdef.h
) )
if(PCH)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
add_library(${LIBRARY_NAME} STATIC ${LIBRARY_SRCS}) add_library(${LIBRARY_NAME} STATIC ${LIBRARY_SRCS})
# Generate precompiled header
if(PCH)
ADD_CXX_PCH(${LIBRARY_NAME} ${game_PCH})
endif()
target_link_libraries(${LIBRARY_NAME} shared detour) target_link_libraries(${LIBRARY_NAME} shared detour)
if(UNIX) if(UNIX)
@ -158,20 +163,6 @@ if(NOT ACE_USE_EXTERNAL)
add_dependencies(${LIBRARY_NAME} ace) add_dependencies(${LIBRARY_NAME} ace)
endif() endif()
# Generate precompiled header
if(PCH)
ADD_CXX_PCH(${LIBRARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/pchdef.h ${CMAKE_CURRENT_SOURCE_DIR}/pchdef.cpp)
endif()
#if(PLAYERBOTS)
# include_directories(
# ${CMAKE_SOURCE_DIR}/src/modules/Bots/playerbot
# ${CMAKE_SOURCE_DIR}/src/modules/Bots/ahbot
# )
# target_link_libraries(${LIBRARY_NAME} Bots)
# add_dependencies(${LIBRARY_NAME} Bots)
#endif()
if(SCRIPT_LIB_SD3) if(SCRIPT_LIB_SD3)
include_directories(${CMAKE_SOURCE_DIR}/src/modules/SD3) include_directories(${CMAKE_SOURCE_DIR}/src/modules/SD3)
target_link_libraries(${LIBRARY_NAME} mangosscript) target_link_libraries(${LIBRARY_NAME} mangosscript)
@ -198,4 +189,4 @@ if(WIN32 AND MSVC)
add_custom_command(TARGET ${LIBRARY_NAME} add_custom_command(TARGET ${LIBRARY_NAME}
POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/AuctionHouseBot/ahbot.conf.dist" "${CONF_COPY_DIR}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/AuctionHouseBot/ahbot.conf.dist" "${CONF_COPY_DIR}"
) )
endif() endif()

View file

@ -171,7 +171,7 @@ void FleeingMovementGenerator<T>::Reset(T& owner)
template<class T> template<class T>
bool FleeingMovementGenerator<T>::Update(T& owner, const uint32& time_diff) bool FleeingMovementGenerator<T>::Update(T& owner, const uint32& time_diff)
{ {
if (!&owner || !owner.IsAlive()) if (!owner.IsAlive())
return false; return false;
// ignore in case other no reaction state // ignore in case other no reaction state

View file

@ -72,9 +72,6 @@ void PointMovementGenerator<T>::Reset(T& unit)
template<class T> template<class T>
bool PointMovementGenerator<T>::Update(T& unit, const uint32& diff) bool PointMovementGenerator<T>::Update(T& unit, const uint32& diff)
{ {
if (!&unit)
return false;
if (unit.hasUnitState(UNIT_STAT_CAN_NOT_MOVE)) if (unit.hasUnitState(UNIT_STAT_CAN_NOT_MOVE))
{ {
unit.clearUnitState(UNIT_STAT_ROAMING_MOVE); unit.clearUnitState(UNIT_STAT_ROAMING_MOVE);

View file

@ -545,9 +545,9 @@ class Creature : public Unit
bool IsGuard() const { return (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_GUARD) != 0; } bool IsGuard() const { return (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_GUARD) != 0; }
bool CanWalk() const { return (GetCreatureInfo()->InhabitType & INHABIT_GROUND) != 0; } bool CanWalk() const { return (GetCreatureInfo()->InhabitType & INHABIT_GROUND) != 0; }
bool CanSwim() const { return (GetCreatureInfo()->InhabitType & INHABIT_WATER) != 0; } virtual bool CanSwim() const override { return (GetCreatureInfo()->InhabitType & INHABIT_WATER) != 0; }
bool IsSwimming() const { return (m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_SWIMMING))); } bool IsSwimming() const { return (m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_SWIMMING))); }
bool CanFly() const { return (GetCreatureInfo()->InhabitType & INHABIT_AIR) || (GetByteValue(UNIT_FIELD_BYTES_1, 3) & UNIT_BYTE1_FLAG_FLY_ANIM) || m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_LEVITATING | MOVEFLAG_CAN_FLY)); } virtual bool CanFly() const override { return (GetCreatureInfo()->InhabitType & INHABIT_AIR) || (GetByteValue(UNIT_FIELD_BYTES_1, 3) & UNIT_BYTE1_FLAG_FLY_ANIM) || m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_LEVITATING | MOVEFLAG_CAN_FLY)); }
bool IsFlying() const { return (m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_FLYING | MOVEFLAG_LEVITATING))); } bool IsFlying() const { return (m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_FLYING | MOVEFLAG_LEVITATING))); }
bool IsTrainerOf(Player* player, bool msg) const; bool IsTrainerOf(Player* player, bool msg) const;
@ -590,7 +590,7 @@ class Creature : public Unit
CreatureAI* AI() { return i_AI; } CreatureAI* AI() { return i_AI; }
void SetWalk(bool enable, bool asDefault = true); void SetWalk(bool enable, bool asDefault = true);
void SetLevitate(bool enable); void SetLevitate(bool enable) override;
void SetSwim(bool enable) override; void SetSwim(bool enable) override;
void SetCanFly(bool enable) override; void SetCanFly(bool enable) override;
void SetFeatherFall(bool enable) override; void SetFeatherFall(bool enable) override;

View file

@ -381,7 +381,7 @@ struct CreatureAIFactory : public SelectableAI
CreatureAI* Create(void*) const override; CreatureAI* Create(void*) const override;
int Permit(const Creature* c) const { return REAL_AI::Permissible(c); } virtual int Permit(const Creature* c) const override { return REAL_AI::Permissible(c); }
}; };
enum Permitions enum Permitions

View file

@ -639,7 +639,7 @@ class CreatureEventAI : public CreatureAI
void GetAIInformation(ChatHandler& reader) override; void GetAIInformation(ChatHandler& reader) override;
void JustRespawned() override; void JustRespawned() override;
void Reset(); void Reset() override;
void JustReachedHome() override; void JustReachedHome() override;
void EnterCombat(Unit* enemy) override; void EnterCombat(Unit* enemy) override;
void EnterEvadeMode() override; void EnterEvadeMode() override;

View file

@ -824,7 +824,7 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
// only rogue have skill for traps detection // only rogue have skill for traps detection
if (Aura* aura = ((Player*)u)->GetAura(2836, EFFECT_INDEX_0)) if (Aura* aura = ((Player*)u)->GetAura(2836, EFFECT_INDEX_0))
{ {
if (roll_chance_i(aura->GetModifier()->m_amount) && u->isInFront(this, 15.0f)) if (roll_chance_i(aura->GetModifier()->m_amount) && u->IsInFront(this, 15.0f))
return true; return true;
} }
@ -1196,7 +1196,7 @@ void GameObject::Use(Unit* user)
bool IsBattleGroundTrap = !radius && goInfo->trap.cooldown == 3 && m_respawnTime == 0; bool IsBattleGroundTrap = !radius && goInfo->trap.cooldown == 3 && m_respawnTime == 0;
// FIXME: when GO casting will be implemented trap must cast spell to target // FIXME: when GO casting will be implemented trap must cast spell to target
if (spellId = goInfo->trap.spellId) if ((spellId = goInfo->trap.spellId))
caster->CastSpell(user, spellId, true, NULL, NULL, GetObjectGuid()); caster->CastSpell(user, spellId, true, NULL, NULL, GetObjectGuid());
// use template cooldown if provided // use template cooldown if provided
m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4)); m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4));

View file

@ -727,7 +727,7 @@ class GameObject : public WorldObject
void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); } void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); } uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }
void SetDisplayId(uint32 modelId); void SetDisplayId(uint32 modelId);
void SetPhaseMask(uint32 newPhaseMask, bool update); void SetPhaseMask(uint32 newPhaseMask, bool update) override;
float GetObjectBoundingRadius() const override; // overwrite WorldObject version float GetObjectBoundingRadius() const override; // overwrite WorldObject version

View file

@ -792,7 +792,7 @@ void Guild::SwitchRank(uint32 rankId, bool up)
if (rankId >= m_Ranks.size()) if (rankId >= m_Ranks.size())
return; return;
if (rankId == GR_GUILDMASTER && up || rankId == GetLowestRank() && !up) if ((rankId == GR_GUILDMASTER && up) || (rankId == GetLowestRank() && !up))
return; return;
uint32 otherRankId = rankId + (up ? -1 : 1); uint32 otherRankId = rankId + (up ? -1 : 1);

View file

@ -287,7 +287,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
if (group && type == LOOT_ITEM_TYPE_CURRENCY) if (group && type == LOOT_ITEM_TYPE_CURRENCY)
{ {
sLog.outErrorDb("Table '%s' entry %d currency %d: group is set, but currencies must not have group - skipped", store.GetName(), entry, itemid, group, 1 << 7); sLog.outErrorDb("Table '%s' entry %d currency %d: has group %u, but currencies must not have group - skipped", store.GetName(), entry, itemid, group);
return false; return false;
} }

View file

@ -1431,22 +1431,22 @@ bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const
return ((angle >= lborder) && (angle <= rborder)); return ((angle >= lborder) && (angle <= rborder));
} }
bool WorldObject::isInFrontInMap(WorldObject const* target, float distance, float arc) const bool WorldObject::IsInFrontInMap(WorldObject const* target, float distance, float arc) const
{ {
return IsWithinDistInMap(target, distance) && HasInArc(arc, target); return IsWithinDistInMap(target, distance) && HasInArc(arc, target);
} }
bool WorldObject::isInBackInMap(WorldObject const* target, float distance, float arc) const bool WorldObject::IsInBackInMap(WorldObject const* target, float distance, float arc) const
{ {
return IsWithinDistInMap(target, distance) && !HasInArc(2 * M_PI_F - arc, target); return IsWithinDistInMap(target, distance) && !HasInArc(2 * M_PI_F - arc, target);
} }
bool WorldObject::isInFront(WorldObject const* target, float distance, float arc) const bool WorldObject::IsInFront(WorldObject const* target, float distance, float arc) const
{ {
return IsWithinDist(target, distance) && HasInArc(arc, target); return IsWithinDist(target, distance) && HasInArc(arc, target);
} }
bool WorldObject::isInBack(WorldObject const* target, float distance, float arc) const bool WorldObject::IsInBack(WorldObject const* target, float distance, float arc) const
{ {
return IsWithinDist(target, distance) && !HasInArc(2 * M_PI_F - arc, target); return IsWithinDist(target, distance) && !HasInArc(2 * M_PI_F - arc, target);
} }

View file

@ -601,10 +601,10 @@ class WorldObject : public Object
float GetAngle(const WorldObject* obj) const; float GetAngle(const WorldObject* obj) const;
float GetAngle(const float x, const float y) const; float GetAngle(const float x, const float y) const;
bool HasInArc(const float arcangle, const WorldObject* obj) const; bool HasInArc(const float arcangle, const WorldObject* obj) const;
bool isInFrontInMap(WorldObject const* target, float distance, float arc = M_PI) const; bool IsInFrontInMap(WorldObject const* target, float distance, float arc = M_PI) const;
bool isInBackInMap(WorldObject const* target, float distance, float arc = M_PI) const; bool IsInBackInMap(WorldObject const* target, float distance, float arc = M_PI) const;
bool isInFront(WorldObject const* target, float distance, float arc = M_PI) const; bool IsInFront(WorldObject const* target, float distance, float arc = M_PI) const;
bool isInBack(WorldObject const* target, float distance, float arc = M_PI) const; bool IsInBack(WorldObject const* target, float distance, float arc = M_PI) const;
virtual void CleanupsBeforeDelete(); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units virtual void CleanupsBeforeDelete(); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units

View file

@ -25,11 +25,11 @@
#ifndef MANGOS_OBJECT_GUID_H #ifndef MANGOS_OBJECT_GUID_H
#define MANGOS_OBJECT_GUID_H #define MANGOS_OBJECT_GUID_H
#include <functional>
#include "Common.h" #include "Common.h"
#include "ByteBuffer.h" #include "ByteBuffer.h"
#include <functional>
enum TypeID enum TypeID
{ {
TYPEID_OBJECT = 0, TYPEID_OBJECT = 0,

View file

@ -162,7 +162,7 @@ class Pet : public Creature
void SetDeathState(DeathState s) override; // overwrite virtual Creature::SetDeathState and Unit::SetDeathState void SetDeathState(DeathState s) override; // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
void Update(uint32 update_diff, uint32 diff) override; // overwrite virtual Creature::Update and Unit::Update void Update(uint32 update_diff, uint32 diff) override; // overwrite virtual Creature::Update and Unit::Update
uint8 GetPetAutoSpellSize() const { return m_autospells.size(); } virtual uint8 GetPetAutoSpellSize() const override { return m_autospells.size(); }
uint32 GetPetAutoSpellOnPos(uint8 pos) const override uint32 GetPetAutoSpellOnPos(uint8 pos) const override
{ {
if (pos >= m_autospells.size()) if (pos >= m_autospells.size())
@ -171,7 +171,7 @@ class Pet : public Creature
return m_autospells[pos]; return m_autospells[pos];
} }
bool CanSwim() const virtual bool CanSwim() const override
{ {
Unit const* owner = GetOwner(); Unit const* owner = GetOwner();
if (owner) if (owner)
@ -290,7 +290,7 @@ class Pet : public Creature
void ResetAuraUpdateMask() { m_auraUpdateMask = 0; } void ResetAuraUpdateMask() { m_auraUpdateMask = 0; }
// overwrite Creature function for name localization back to WorldObject version without localization // overwrite Creature function for name localization back to WorldObject version without localization
const char* GetNameForLocaleIdx(int32 locale_idx) const { return WorldObject::GetNameForLocaleIdx(locale_idx); } virtual const char* GetNameForLocaleIdx(int32 locale_idx) const override { return WorldObject::GetNameForLocaleIdx(locale_idx); }
DeclinedName const* GetDeclinedNames() const { return m_declinedname; } DeclinedName const* GetDeclinedNames() const { return m_declinedname; }

View file

@ -5609,7 +5609,7 @@ bool Player::UpdateCraftSkill(uint32 spellid)
uint32 craft_skill_gain = sWorld.getConfig(CONFIG_UINT32_SKILL_GAIN_CRAFTING); uint32 craft_skill_gain = sWorld.getConfig(CONFIG_UINT32_SKILL_GAIN_CRAFTING);
if (!_spell_idx->second->characterPoints) if (!_spell_idx->second->characterPoints)
sLog.outError("Player::UpdateCraftSkill spell %u has characterPoints == 0!"); sLog.outError("Player::UpdateCraftSkill spell %u has characterPoints == 0!", spellid);
else else
craft_skill_gain += _spell_idx->second->characterPoints - 1; craft_skill_gain += _spell_idx->second->characterPoints - 1;
@ -17133,7 +17133,7 @@ DungeonPersistentState* Player::GetBoundInstanceSaveForSelfOrGroup(uint32 mapid)
InstanceGroupBind* groupBind = NULL; InstanceGroupBind* groupBind = NULL;
// use the player's difficulty setting (it may not be the same as the group's) // use the player's difficulty setting (it may not be the same as the group's)
if (Group* group = GetGroup()) if (Group* group = GetGroup())
if (groupBind = group->GetBoundInstance(mapid, this)) if ((groupBind = group->GetBoundInstance(mapid, this)))
state = groupBind->state; state = groupBind->state;
} }
@ -20527,7 +20527,7 @@ void Player::SendTransferAbortedByLockStatus(MapEntry const* mapEntry, AreaLockS
case AREA_LOCKSTATUS_QUEST_NOT_COMPLETED: case AREA_LOCKSTATUS_QUEST_NOT_COMPLETED:
if (mapEntry->MapID == 269) // Exception for Black Morass if (mapEntry->MapID == 269) // Exception for Black Morass
{ {
GetSession()->SendAreaTriggerMessage(GetSession()->GetMangosString(LANG_TELEREQ_QUEST_BLACK_MORASS)); GetSession()->SendAreaTriggerMessage("%s", GetSession()->GetMangosString(LANG_TELEREQ_QUEST_BLACK_MORASS));
break; break;
} }
else if (mapEntry->IsContinent()) // do not report anything for quest areatrigge else if (mapEntry->IsContinent()) // do not report anything for quest areatrigge

View file

@ -2412,8 +2412,8 @@ class Player : public Unit
bool isMoving() const { return m_movementInfo.HasMovementFlag(movementFlagsMask); } bool isMoving() const { return m_movementInfo.HasMovementFlag(movementFlagsMask); }
bool isMovingOrTurning() const { return m_movementInfo.HasMovementFlag(movementOrTurningFlagsMask); } bool isMovingOrTurning() const { return m_movementInfo.HasMovementFlag(movementOrTurningFlagsMask); }
bool CanSwim() const { return true; } virtual bool CanSwim() const override { return true; }
bool CanFly() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_CAN_FLY); } virtual bool CanFly() const override { return m_movementInfo.HasMovementFlag(MOVEFLAG_CAN_FLY); }
bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_FLYING); } bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_FLYING); }
bool IsFreeFlying() const { return HasAuraType(SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED) || HasAuraType(SPELL_AURA_FLY); } bool IsFreeFlying() const { return HasAuraType(SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED) || HasAuraType(SPELL_AURA_FLY); }
bool CanStartFlyInArea(uint32 mapid, uint32 zone, uint32 area) const; bool CanStartFlyInArea(uint32 mapid, uint32 zone, uint32 area) const;

View file

@ -247,11 +247,10 @@ inline bool IsLootCraftingSpell(SpellEntry const* spellInfo)
SpellTotemsEntry const* totems = spellInfo->GetSpellTotems(); SpellTotemsEntry const* totems = spellInfo->GetSpellTotems();
return spellEffect0->Effect == SPELL_EFFECT_CREATE_RANDOM_ITEM || return ((spellEffect0->Effect == SPELL_EFFECT_CREATE_RANDOM_ITEM) ||
// different random cards from Inscription (121==Virtuoso Inking Set category) or without explicit item or explicit spells // different random cards from Inscription (121==Virtuoso Inking Set category) or without explicit item or explicit spells
spellEffect0->Effect == SPELL_EFFECT_CREATE_ITEM_2 && ((spellEffect0->Effect == SPELL_EFFECT_CREATE_ITEM_2) && ((totems && totems->TotemCategory[0] != 0) || (spellEffect0->EffectItemType == 0))) ||
(totems && totems->TotemCategory[0] != 0 || spellEffect0->EffectItemType == 0) || (spellInfo->Id == 62941));
spellInfo->Id == 62941;
} }
int32 CompareAuraRanks(uint32 spellId_1, uint32 spellId_2); int32 CompareAuraRanks(uint32 spellId_1, uint32 spellId_2);

View file

@ -8859,7 +8859,7 @@ bool Unit::IsVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
float visibleDistance = (u->GetTypeId() == TYPEID_PLAYER) ? MAX_PLAYER_STEALTH_DETECT_RANGE : ((Creature const*)u)->GetAttackDistance(this); float visibleDistance = (u->GetTypeId() == TYPEID_PLAYER) ? MAX_PLAYER_STEALTH_DETECT_RANGE : ((Creature const*)u)->GetAttackDistance(this);
// Always invisible from back (when stealth detection is on), also filter max distance cases // Always invisible from back (when stealth detection is on), also filter max distance cases
bool isInFront = viewPoint->isInFrontInMap(this, visibleDistance); bool isInFront = viewPoint->IsInFrontInMap(this, visibleDistance);
if (!isInFront) if (!isInFront)
return false; return false;

View file

@ -150,7 +150,7 @@ class WorldSocket : protected WorldHandler
/// Called when connection is closed or error happens. /// Called when connection is closed or error happens.
virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) override;
/// Called by WorldSocketMgr/ReactorRunnable. /// Called by WorldSocketMgr/ReactorRunnable.
int Update(void); int Update(void);

View file

@ -50,7 +50,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
sCalendarMgr.GetPlayerInvitesList(guid, invites); sCalendarMgr.GetPlayerInvitesList(guid, invites);
data << uint32(invites.size()); data << uint32(invites.size());
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Sending > %u invites", invites.size()); DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Sending > " SIZEFMTD " invites", invites.size());
for (CalendarInvitesList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr) for (CalendarInvitesList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{ {
@ -72,7 +72,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
sCalendarMgr.GetPlayerEventsList(guid, events); sCalendarMgr.GetPlayerEventsList(guid, events);
data << uint32(events.size()); data << uint32(events.size());
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Sending > %u events", events.size()); DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Sending > " SIZEFMTD " events", events.size());
for (CalendarEventsList::const_iterator itr = events.begin(); itr != events.end(); ++itr) for (CalendarEventsList::const_iterator itr = events.begin(); itr != events.end(); ++itr)
{ {
@ -516,7 +516,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
invite.LastUpdateTime = time(NULL); invite.LastUpdateTime = time(NULL);
sCalendarMgr.SendCalendarEventInvite(&invite); sCalendarMgr.SendCalendarEventInvite(&invite);
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "PREINVITE> sender[%s], Invitee[%u]", playerGuid.GetString().c_str(), inviteeGuid.GetString().c_str()); DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "PREINVITE> sender[%s], Invitee[%s]", playerGuid.GetString().c_str(), inviteeGuid.GetString().c_str());
} }
} }

View file

@ -783,11 +783,15 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
*data << uint32(holder->GetId()); *data << uint32(holder->GetId());
*data << uint16(holder->GetAuraFlags()); *data << uint16(holder->GetAuraFlags());
if (holder->GetAuraFlags() & AFLAG_EFFECT_AMOUNT_SEND) if (holder->GetAuraFlags() & AFLAG_EFFECT_AMOUNT_SEND)
{
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i))) if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
*data << int32(aura->GetModifier()->m_amount); { *data << int32(aura->GetModifier()->m_amount); }
else else
*data << int32(0); { *data << int32(0); }
}
}
} }
else else
{ {
@ -876,11 +880,15 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
*data << uint32(holder->GetId()); *data << uint32(holder->GetId());
*data << uint16(holder->GetAuraFlags()); *data << uint16(holder->GetAuraFlags());
if (holder->GetAuraFlags() & AFLAG_EFFECT_AMOUNT_SEND) if (holder->GetAuraFlags() & AFLAG_EFFECT_AMOUNT_SEND)
{
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i))) if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
*data << int32(aura->GetModifier()->m_amount); { *data << int32(aura->GetModifier()->m_amount); }
else else
*data << int32(0); { *data << int32(0); }
}
}
} }
else else
{ {
@ -1006,11 +1014,15 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recv_data)
data << uint32(holder->GetId()); data << uint32(holder->GetId());
data << uint16(holder->GetAuraFlags()); data << uint16(holder->GetAuraFlags());
if (holder->GetAuraFlags() & AFLAG_EFFECT_AMOUNT_SEND) if (holder->GetAuraFlags() & AFLAG_EFFECT_AMOUNT_SEND)
{
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i))) if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
data << int32(aura->GetModifier()->m_amount); { data << int32(aura->GetModifier()->m_amount); }
else else
data << int32(0); { data << int32(0); }
}
}
} }
} }
data.put<uint64>(maskPos, auramask); // GROUP_UPDATE_FLAG_AURAS data.put<uint64>(maskPos, auramask); // GROUP_UPDATE_FLAG_AURAS
@ -1041,11 +1053,15 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recv_data)
data << uint32(holder->GetId()); data << uint32(holder->GetId());
data << uint16(holder->GetAuraFlags()); data << uint16(holder->GetAuraFlags());
if (holder->GetAuraFlags() & AFLAG_EFFECT_AMOUNT_SEND) if (holder->GetAuraFlags() & AFLAG_EFFECT_AMOUNT_SEND)
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) {
if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i))) for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
data << int32(aura->GetModifier()->m_amount); {
else if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
data << int32(0); { data << int32(aura->GetModifier()->m_amount); }
else
{ data << int32(0); }
}
}
} }
} }
data.put<uint64>(petMaskPos, petauramask); // GROUP_UPDATE_FLAG_PET_AURAS data.put<uint64>(petMaskPos, petauramask); // GROUP_UPDATE_FLAG_PET_AURAS

View file

@ -574,7 +574,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid)
float discountMod = _player->GetReputationPriceDiscount(pCreature); float discountMod = _player->GetReputationPriceDiscount(pCreature);
uint8 count = 0; uint16 count = 0;
ByteBuffer buffer; ByteBuffer buffer;
for (uint8 vendorslot = 0; vendorslot < numitems; ++vendorslot) for (uint8 vendorslot = 0; vendorslot < numitems; ++vendorslot)
{ {

View file

@ -209,7 +209,6 @@ class MailDraft
explicit MailDraft(uint16 mailTemplateId, bool need_items = true) explicit MailDraft(uint16 mailTemplateId, bool need_items = true)
: m_mailTemplateId(mailTemplateId), m_mailTemplateItemsNeed(need_items), m_money(0), m_COD(0) : m_mailTemplateId(mailTemplateId), m_mailTemplateItemsNeed(need_items), m_money(0), m_COD(0)
{} {}
/**
/** /**
* Creates a new MailDraft object using subject and content texts. * Creates a new MailDraft object using subject and content texts.
* *

View file

@ -887,23 +887,23 @@ namespace MaNGOS
switch (i_push_type) switch (i_push_type)
{ {
case PUSH_IN_FRONT: case PUSH_IN_FRONT:
if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, 2 * M_PI_F / 3)) if (i_castingObject->IsInFront((Unit*)(itr->getSource()), i_radius, 2 * M_PI_F / 3))
i_data->push_back(itr->getSource()); i_data->push_back(itr->getSource());
break; break;
case PUSH_IN_FRONT_90: case PUSH_IN_FRONT_90:
if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F / 2)) if (i_castingObject->IsInFront((Unit*)(itr->getSource()), i_radius, M_PI_F / 2))
i_data->push_back(itr->getSource()); i_data->push_back(itr->getSource());
break; break;
case PUSH_IN_FRONT_30: case PUSH_IN_FRONT_30:
if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F / 6)) if (i_castingObject->IsInFront((Unit*)(itr->getSource()), i_radius, M_PI_F / 6))
i_data->push_back(itr->getSource()); i_data->push_back(itr->getSource());
break; break;
case PUSH_IN_FRONT_15: case PUSH_IN_FRONT_15:
if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F / 12)) if (i_castingObject->IsInFront((Unit*)(itr->getSource()), i_radius, M_PI_F / 12))
i_data->push_back(itr->getSource()); i_data->push_back(itr->getSource());
break; break;
case PUSH_IN_BACK: case PUSH_IN_BACK:
if (i_castingObject->isInBack((Unit*)(itr->getSource()), i_radius, 2 * M_PI_F / 3)) if (i_castingObject->IsInBack((Unit*)(itr->getSource()), i_radius, 2 * M_PI_F / 3))
i_data->push_back(itr->getSource()); i_data->push_back(itr->getSource());
break; break;
case PUSH_SELF_CENTER: case PUSH_SELF_CENTER:

View file

@ -4031,11 +4031,15 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
// Polymorph (sheep/penguin case) // Polymorph (sheep/penguin case)
if (GetSpellProto()->GetSpellFamilyName() == SPELLFAMILY_MAGE && GetSpellProto()->SpellIconID == 82) if (GetSpellProto()->GetSpellFamilyName() == SPELLFAMILY_MAGE && GetSpellProto()->SpellIconID == 82)
{
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
{
if (caster->HasAura(52648)) // Glyph of the Penguin if (caster->HasAura(52648)) // Glyph of the Penguin
model_id = 26452; { model_id = 26452; }
else if (caster->HasAura(57927)) // Glyph of the Monkey else if (caster->HasAura(57927)) // Glyph of the Monkey
model_id = 21362; { model_id = 21362; }
}
}
target->SetDisplayId(model_id); target->SetDisplayId(model_id);
@ -9583,11 +9587,15 @@ void SpellAuraHolder::BuildUpdatePacket(WorldPacket& data) const
if (auraFlags & AFLAG_EFFECT_AMOUNT_SEND) if (auraFlags & AFLAG_EFFECT_AMOUNT_SEND)
{ {
for (uint8 i = 0; i < MAX_EFFECT_INDEX; ++i) for (uint8 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if (auraFlags & (1 << i)) if (auraFlags & (1 << i))
{
if (Aura const* aura = m_auras[i]) if (Aura const* aura = m_auras[i])
data << int32(aura->GetModifier()->m_amount); { data << int32(aura->GetModifier()->m_amount); }
else else
data << int32(0); { data << int32(0); }
}
}
} }
} }

View file

@ -69,7 +69,7 @@ void WorldSession::SendTradeStatus(TradeStatus status)
data << uint32(0); data << uint32(0);
break; break;
} }
case 31: case 31: // WTF is this?
{ {
data.WriteBit(false); data.WriteBit(false);
data << uint32(0); data << uint32(0);

View file

@ -1 +1 @@
//#include "pchdef.h" #include "pchdef.h"

View file

@ -23,6 +23,9 @@
*/ */
// add here most rarely modified headers to speed up debug build compilation // add here most rarely modified headers to speed up debug build compilation
#ifndef GAME_PCH_H
#define GAME_PCH_H
#include "WorldSocket.h" // must be first to make ACE happy with ACE includes in it #include "WorldSocket.h" // must be first to make ACE happy with ACE includes in it
#include "Common.h" #include "Common.h"
@ -36,3 +39,5 @@
#include "GuildMgr.h" #include "GuildMgr.h"
#include "ObjectMgr.h" #include "ObjectMgr.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#endif

View file

@ -42,7 +42,7 @@ class WorldThread : public ACE_Task_Base
public: public:
explicit WorldThread(uint16 port, const char* host); explicit WorldThread(uint16 port, const char* host);
virtual int open(void*) override; virtual int open(void*) override;
virtual int svc(); virtual int svc() override;
private: private:
ACE_INET_Addr listen_addr; ACE_INET_Addr listen_addr;
}; };

View file

@ -169,7 +169,7 @@ class MySQLConnection : public SqlConnection
* @param length * @param length
* @return unsigned long * @return unsigned long
*/ */
unsigned long escape_string(char* to, const char* from, unsigned long length); unsigned long escape_string(char* to, const char* from, unsigned long length) override;
/** /**
* @brief * @brief

View file

@ -38,6 +38,7 @@
#ifndef WIN32 #ifndef WIN32
#include <stddef.h> #include <stddef.h>
#include <dirent.h> #include <dirent.h>
#include <errno.h>
#endif #endif
using namespace std; using namespace std;