From c529566ac41e6d14c33015664e43c195a7a36bb6 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 12 Jun 2016 00:11:00 +0200 Subject: Core/GameObejcts: Fixed disconnects happening when viewing nearby players on elevators Closes #17335 --- src/server/game/Entities/Object/Object.cpp | 2 +- src/server/game/Entities/Object/ObjectGuid.h | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src/server/game/Entities/Object') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index f9fa1b3aeb6..9493df4449c 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2385,7 +2385,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float Map* map = GetMap(); GameObject* go = new GameObject(); - if (!go->Create(map->GenerateLowGuid(), entry, map, GetPhaseMask(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY)) + if (!go->Create(entry, map, GetPhaseMask(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY)) { delete go; return NULL; diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h index 505170a2663..86593a7c211 100644 --- a/src/server/game/Entities/Object/ObjectGuid.h +++ b/src/server/game/Entities/Object/ObjectGuid.h @@ -159,7 +159,6 @@ GUID_TRAIT_GLOBAL(HighGuid::CommerceObj) GUID_TRAIT_GLOBAL(HighGuid::ClientSession) GUID_TRAIT_REALM_SPECIFIC(HighGuid::Player) GUID_TRAIT_REALM_SPECIFIC(HighGuid::Item) // This is not exactly correct, there are 2 more unknown parts in highguid: (high >> 10 & 0xFF), (high >> 18 & 0xFFFFFF) -GUID_TRAIT_REALM_SPECIFIC(HighGuid::Transport) GUID_TRAIT_REALM_SPECIFIC(HighGuid::Guild) GUID_TRAIT_MAP_SPECIFIC(HighGuid::WorldTransaction) GUID_TRAIT_MAP_SPECIFIC(HighGuid::Conversation) @@ -181,6 +180,19 @@ GUID_TRAIT_MAP_SPECIFIC(HighGuid::AIResource) GUID_TRAIT_MAP_SPECIFIC(HighGuid::AILock) GUID_TRAIT_MAP_SPECIFIC(HighGuid::AILockTicket) +// Special case +// Global transports are loaded from `transports` table, RealmSpecific part is used for them. +// after worldserver finishes loading, no more global transports can be created, only the ones existing within instances that never change maps +// here is where MapSpecific comes into play - each map takes over the responsibility to generate transport guids +// on top of this, regular elevators (GAMEOBJECT_TYPE_TRANSPORT) must also use Transport highguid type, otherwise client will reject seeing other players on them +template<> +struct ObjectGuidTraits +{ + static bool const Global = false; + static bool const RealmSpecific = true; + static bool const MapSpecific = true; +}; + class ObjectGuid; class PackedGuid; @@ -205,7 +217,7 @@ class TC_GAME_API ObjectGuid static typename std::enable_if::RealmSpecific, ObjectGuid>::type Create(LowType counter) { return RealmSpecific(type, counter); } template - static typename std::enable_if::MapSpecific, ObjectGuid>::type Create(uint16 mapId, uint32 entry, LowType counter) { return MapSpecific(type, 0, mapId, 0, entry, counter); } + static typename std::enable_if::MapSpecific && type != HighGuid::Transport, ObjectGuid>::type Create(uint16 mapId, uint32 entry, LowType counter) { return MapSpecific(type, 0, mapId, 0, entry, counter); } ObjectGuid() : _low(0), _high(0) { } -- cgit v1.2.3