Hi guys, I was looking the code of the 3.3.5 branch, and something got my attention, I will explain the case below.
If I (a Player) teleport to a diff map than mine (I mean diff mapId, wiht command or something else), I will call TeleportTo, then
Map* oldmap = IsInWorld() ? GetMap() : nullptr;
oldmap will return something because at that point, I was already in a map, and GetMap can't return null because of ASSERT and I'm in a world too, then oldmap will do this
in the part of UpdateObjectVisibility(true) it will call Player::UpdateVisibilityForPlayer() at somepoint, then it will call VisibleNotifier with all G and W objects, and again Player::UpdateVisibilityOf ...
now here is where I got lost, let's said I call a T = Creature
if (HaveAtClient(target)) // in this case it will return true, it's an object that's in my client
if (!CanSeeOrDetect(target, false, true))
It should return false, because i'm changing world, so the Creature can be removed from my client vision, but where is that check, if I look into it, I got this
bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, bool distanceCheck, bool checkAlert) const
if (this == obj)
// IsNeverVisible will return false || CanNeverSee will return false, because they are in the same GetMap() and same phase, since it doesn't change for a movement of worlds
if (obj->IsNeverVisible() || CanNeverSee(obj))
// those 2 will return false
if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj))
Then some checks of distance or ghost and dead stuff, but, doesn't it return false at the beginning like if (!IsInWorld()) return false; or where it does something like that? Because I got it returning true when should be false