Skip to content

Commit

Permalink
Fixed merge
Browse files Browse the repository at this point in the history
  • Loading branch information
tomrus88 committed Dec 5, 2008
1 parent e319a4e commit 129efa6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 63 deletions.
2 changes: 1 addition & 1 deletion src/game/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const
}

// check distance
return IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForObject() +
return IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject() +
(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
}

Expand Down
13 changes: 0 additions & 13 deletions src/game/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,19 +1123,6 @@ bool WorldObject::IsWithinDistInMap(const WorldObject* obj, const float dist2com
return distsq < maxdist * maxdist;
}

bool WorldObject::IsWithinDistInMap2d(const WorldObject* obj, const float dist2compare) const
{
if (!obj || !IsInMap(obj)) return false;

float dx = GetPositionX() - obj->GetPositionX();
float dy = GetPositionY() - obj->GetPositionY();
float distsq = dx*dx + dy*dy;
float sizefactor = GetObjectSize() + obj->GetObjectSize();
float maxdist = dist2compare + sizefactor;

return distsq < maxdist * maxdist;
}

bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const
{
if (!IsInMap(obj)) return false;
Expand Down
1 change: 0 additions & 1 deletion src/game/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ class MANGOS_DLL_SPEC WorldObject : public Object
float GetDistanceZ(const WorldObject* obj) const;
bool IsInMap(const WorldObject* obj) const { return GetMapId()==obj->GetMapId() && GetInstanceId()==obj->GetInstanceId(); }
bool IsWithinDistInMap(const WorldObject* obj, const float dist2compare, const bool is3D = true) const;
bool IsWithinDistInMap2d(const WorldObject* obj, const float dist2compare) const;
bool IsWithinLOS(const float x, const float y, const float z ) const;
bool IsWithinLOSInMap(const WorldObject* obj) const;

Expand Down
54 changes: 6 additions & 48 deletions src/game/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8599,81 +8599,39 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList,
{
// use object grey distance for all (only see objects any way)
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
{
if (!IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)))
return false;
}
else
{
return false;
}
return false;
}
else if(!isAlive()) // distance for show body
{
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
{
if (!IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)))
return false;
}
else
{
return false;
}
return false;
}
else if(GetTypeId()==TYPEID_PLAYER) // distance for show player
{
if(u->GetTypeId()==TYPEID_PLAYER)
{
// Players far than max visible distance for player or not in our map are not visible too
if (!at_same_transport && !IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
{
if (!at_same_transport && !IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
return false;
}
else
{
return false;
}
return false;
}
else
{
// Units far than max visible distance for creature or not in our map are not visible too
if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
{
if (!IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
return false;
}
else
{
return false;
}
return false;
}
}
else if(GetCharmerOrOwnerGUID()) // 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(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
{
if (!IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
return false;
}
else
{
return false;
}
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(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
{
if (!IsWithinDistInMap2d(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
return false;
}
else
{
return false;
}
return false;
}

// Visible units, always are visible for all units, except for units under invisibility
Expand Down

2 comments on commit 129efa6

@Gliht
Copy link

@Gliht Gliht commented on 129efa6 Dec 5, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have strange problems: DK start with lvl1, all clothes are in Bags, and there is 2xall of them. FDB don’t work! It’s fine only when I delete table “creature_movement”. What I’m doying wrong :/?

@arrai
Copy link
Contributor

@arrai arrai commented on 129efa6 Dec 7, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the forum for such questions. Comments are just intended to be used for commit related issues.

Please sign in to comment.