Core/Units: Rename and change Get/SetVisibility to use a bool value instead of an unnecessary enum
Also replace some SetVisibility hacks to directly call UpdateObjectVisibility --HG-- branch : trunk
This commit is contained in:
@@ -814,7 +814,7 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
|
||||
}
|
||||
|
||||
if (Entry == VISUAL_WAYPOINT)
|
||||
SetVisibility(VISIBILITY_OFF);
|
||||
SetVisible(false);
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
@@ -1598,7 +1598,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
|
||||
Creature *trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, 1);
|
||||
if (!trigger) return;
|
||||
|
||||
trigger->SetVisibility(VISIBILITY_OFF); //should this be true?
|
||||
trigger->SetVisible(false); //should this be true?
|
||||
if (Unit *owner = GetOwner())
|
||||
{
|
||||
trigger->setFaction(owner->getFaction());
|
||||
|
||||
@@ -20520,7 +20520,7 @@ bool Player::IsVisibleGloballyFor(Player* u) const
|
||||
return true;
|
||||
|
||||
// Visible units, always are visible for all players
|
||||
if (GetVisibility() == VISIBILITY_ON)
|
||||
if (IsVisible())
|
||||
return true;
|
||||
|
||||
// GMs are visible for higher gms (or players are visible for gms)
|
||||
@@ -20528,7 +20528,7 @@ bool Player::IsVisibleGloballyFor(Player* u) const
|
||||
return GetSession()->GetSecurity() <= u->GetSession()->GetSecurity();
|
||||
|
||||
// non faction visibility non-breakable for non-GMs
|
||||
if (GetVisibility() == VISIBILITY_OFF)
|
||||
if (!IsVisible())
|
||||
return false;
|
||||
|
||||
// non-gm stealth/invisibility not hide from global player lists
|
||||
|
||||
@@ -12140,9 +12140,9 @@ bool Unit::isAlwaysDetectableFor(WorldObject const* seer) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void Unit::SetVisibility(UnitVisibility x)
|
||||
void Unit::SetVisible(bool x)
|
||||
{
|
||||
if (x == VISIBILITY_OFF)
|
||||
if (!x)
|
||||
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GM, SEC_GAMEMASTER);
|
||||
else
|
||||
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GM, SEC_PLAYER);
|
||||
@@ -14700,13 +14700,13 @@ void Unit::SetContestedPvP(Player *attackedPlayer)
|
||||
player->addUnitState(UNIT_STAT_ATTACK_PLAYER);
|
||||
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP);
|
||||
// call MoveInLineOfSight for nearby contested guards
|
||||
player->SetVisibility(player->GetVisibility());
|
||||
UpdateObjectVisibility();
|
||||
}
|
||||
if (!hasUnitState(UNIT_STAT_ATTACK_PLAYER))
|
||||
{
|
||||
addUnitState(UNIT_STAT_ATTACK_PLAYER);
|
||||
// call MoveInLineOfSight for nearby contested guards
|
||||
SetVisibility(GetVisibility());
|
||||
UpdateObjectVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -540,12 +540,6 @@ enum DamageEffectType
|
||||
SELF_DAMAGE = 5
|
||||
};
|
||||
|
||||
enum UnitVisibility
|
||||
{
|
||||
VISIBILITY_OFF = 0,
|
||||
VISIBILITY_ON = 1
|
||||
};
|
||||
|
||||
// Value masks for UNIT_FIELD_FLAGS
|
||||
enum UnitFlags
|
||||
{
|
||||
@@ -1763,8 +1757,8 @@ class Unit : public WorldObject
|
||||
void SetFacingToObject(WorldObject* pObject);
|
||||
|
||||
// Visibility system
|
||||
UnitVisibility GetVisibility() const { return (m_serverSideVisibility.GetValue(SERVERSIDE_VISIBILITY_GM) > SEC_PLAYER) ? VISIBILITY_OFF : VISIBILITY_ON; }
|
||||
void SetVisibility(UnitVisibility x);
|
||||
bool IsVisible() const { return (m_serverSideVisibility.GetValue(SERVERSIDE_VISIBILITY_GM) > SEC_PLAYER) ? false : true; }
|
||||
void SetVisible(bool x);
|
||||
|
||||
// common function for visibility checks for player/creatures with detection code
|
||||
|
||||
|
||||
Reference in New Issue
Block a user