Skip to content

Commit

Permalink
Vehicle: Do not show passengers of vehicle that is not visible to the…
Browse files Browse the repository at this point in the history
… player
  • Loading branch information
insunaa committed Feb 22, 2023
1 parent fd1bc8a commit 5a3d198
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/game/Entities/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -2360,7 +2360,7 @@ class Player : public Unit
Object* GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask);

// currently visible objects at player client
bool HasAtClient(WorldObject const* u) { return u == this || m_clientGUIDs.find(u->GetObjectGuid()) != m_clientGUIDs.end(); }
bool HasAtClient(WorldObject const* u) const { return u == this || m_clientGUIDs.find(u->GetObjectGuid()) != m_clientGUIDs.end(); }
void AddAtClient(WorldObject* target);
void RemoveAtClient(WorldObject* target);
GuidSet& GetClientGuids() { return m_clientGUIDs; }
Expand Down
6 changes: 6 additions & 0 deletions src/game/Entities/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10070,6 +10070,12 @@ bool Unit::IsVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
if (m_Visibility == VISIBILITY_REMOVE_CORPSE)
return false;

if (this->IsBoarded())
if (Unit* vehicle = dynamic_cast<Unit*>(this->GetTransportInfo()->GetTransport()))
if (const Player* player = dynamic_cast<const Player*>(u))
if (!player->HasAtClient(vehicle))
return false;

Map& _map = *u->GetMap();
// Grid dead/alive checks
if (u->GetTypeId() == TYPEID_PLAYER)
Expand Down

0 comments on commit 5a3d198

Please sign in to comment.