From ae65d36bb4ecca988c5635f493b5f957b51c5870 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Wed, 18 Mar 2009 21:04:47 +0100 Subject: [PATCH 1/3] * Implemented new ObjectAccessor functions: GetCreatures, GetUnits, GetGameObjects, and GetWorldObjects. These can be used for loopong over objects in the world. * Note: GetWorldObjects is (probably) heavy and should be used very sparingly. Always use the function corresponding to the type of object you're looping over. --HG-- branch : trunk --- src/game/ObjectAccessor.h | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index fea2331695..218d1d9199 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -154,9 +154,30 @@ class TRINITY_DLL_DECL ObjectAccessor : public Trinity::Singleton::MapType& GetPlayers() - { - return HashMapHolder::GetContainer(); + HashMapHolder::MapType& GetPlayers() + { + return HashMapHolder::GetContainer(); + } + + HashMapHolder::MapType& GetCreatures() + { + return HashMapHolder::GetContainer(); + } + + HashMapHolder::MapType& GetUnits() + { + return HashMapHolder::GetContainer(); + } + + HashMapHolder::MapType& GetGameObjects() + { + return HashMapHolder::GetContainer(); + } + + // note: possibly very heavy + HashMapHolder::MapType& GetWorldObjects() + { + return HashMapHolder::GetContainer(); } template void AddObject(T *object) From 103125cfbd9daa44397ea3b731549c7822c4541a Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Wed, 18 Mar 2009 21:18:45 +0100 Subject: [PATCH 2/3] * Do not output "Table `game_graveyard_zone` incomplete" for maps of type MAP_ARENA. These are not meant to have graveyards anyway. --HG-- branch : trunk --- src/game/ObjectMgr.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index ba6d78f637..3abd08c07d 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4834,7 +4834,10 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float // then check faction GraveYardMap::const_iterator graveLow = mGraveYardMap.lower_bound(zoneId); GraveYardMap::const_iterator graveUp = mGraveYardMap.upper_bound(zoneId); - if(graveLow==graveUp) + MapEntry const* map = sMapStore.LookupEntry(MapId); + // not need to check validity of map object; MapId _MUST_ be valid here + + if(graveLow==graveUp && !map->IsBattleArena()) { sLog.outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.",zoneId,team); return NULL; From d84cec89c040766c770576074e1b1f03154c5c37 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Wed, 18 Mar 2009 21:34:59 +0100 Subject: [PATCH 3/3] * Added specialized ByteBuffer::read for std::string. This will aid in packet processing later. --HG-- branch : trunk --- src/shared/ByteBuffer.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 97b6c1cbd1..801270fa71 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -228,6 +228,12 @@ class ByteBuffer _rpos += sizeof(T); return r; }; + template<> std::string read() + { + std::string tmp; + *this >> tmp; + return tmp; + } template T read(size_t pos) const { ASSERT(pos + sizeof(T) <= size() || PrintPosError(false,pos,sizeof(T)));