mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[10805] Remove code duplication in visibility distance check.
at_same_transport already include player checks at assign and it move to common if make 3 distance cases exactly same. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
47bdcd1595
commit
29f7f05414
2 changed files with 3 additions and 24 deletions
|
|
@ -7863,30 +7863,9 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
|
||||||
if (!IsWithinDistInMap(viewPoint,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
if (!IsWithinDistInMap(viewPoint,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if(GetTypeId()==TYPEID_PLAYER) // distance for show player
|
else if(!at_same_transport) // distance for show player/pet/creature (no transport case)
|
||||||
{
|
{
|
||||||
if(u->GetTypeId()==TYPEID_PLAYER)
|
// Any units far than max visible distance for viewer or not in our map are not visible too
|
||||||
{
|
|
||||||
// Players far than max visible distance for player or not in our map are not visible too
|
|
||||||
if (!at_same_transport && !IsWithinDistInMap(viewPoint, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Units far than max visible distance for creature or not in our map are not visible too
|
|
||||||
if (!IsWithinDistInMap(viewPoint, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!GetCharmerOrOwnerGuid().IsEmpty()) // distance for show pet/charmed
|
|
||||||
{
|
|
||||||
// Pet/charmed far than max visible distance for player or not in our map are not visible too
|
|
||||||
if (!IsWithinDistInMap(viewPoint, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else // distance for show creature
|
|
||||||
{
|
|
||||||
// Units far than max visible distance for creature or not in our map are not visible too
|
|
||||||
if (!IsWithinDistInMap(viewPoint, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
if (!IsWithinDistInMap(viewPoint, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10804"
|
#define REVISION_NR "10805"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue