[11573] Add CreatureInfo::GetObjectGuid

Also remove redundent CreatureData::GetHighGuid
This commit is contained in:
VladimirMangos 2011-05-31 02:46:43 +04:00
parent 442e06090d
commit 8698ac207d
3 changed files with 7 additions and 6 deletions

View file

@ -50,10 +50,10 @@
#include "Policies/SingletonImp.h" #include "Policies/SingletonImp.h"
HighGuid CreatureData::GetHighGuid() const ObjectGuid CreatureData::GetObjectGuid(uint32 lowguid) const
{ {
// info existence checked at loading // info existence checked at loading
return ObjectMgr::GetCreatureTemplate(id)->GetHighGuid(); return ObjectMgr::GetCreatureTemplate(id)->GetObjectGuid(lowguid);
} }
TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
@ -1280,7 +1280,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map)
GameEventCreatureData const* eventData = sGameEventMgr.GetCreatureUpdateDataForActiveEvent(guidlow); GameEventCreatureData const* eventData = sGameEventMgr.GetCreatureUpdateDataForActiveEvent(guidlow);
// Creature can be loaded already in map if grid has been unloaded while creature walk to another grid // Creature can be loaded already in map if grid has been unloaded while creature walk to another grid
if (map->GetCreature(data->GetObjectGuid(guidlow))) if (map->GetCreature(cinfo->GetObjectGuid(guidlow)))
return false; return false;
CreatureCreatePos pos(map, data->posX, data->posY, data->posZ, data->orientation, data->phaseMask); CreatureCreatePos pos(map, data->posX, data->posY, data->posZ, data->orientation, data->phaseMask);

View file

@ -147,6 +147,8 @@ struct CreatureInfo
return vehicleId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT; return vehicleId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT;
} }
ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), Entry, lowguid); }
SkillType GetRequiredLootSkill() const SkillType GetRequiredLootSkill() const
{ {
if(type_flags & CREATURE_TYPEFLAGS_HERBLOOT) if(type_flags & CREATURE_TYPEFLAGS_HERBLOOT)
@ -202,8 +204,7 @@ struct CreatureData
uint8 spawnMask; uint8 spawnMask;
// helper function // helper function
HighGuid GetHighGuid() const; ObjectGuid GetObjectGuid(uint32 lowguid) const;
ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), id, lowguid); }
}; };
// from `creature_addon` and `creature_template_addon`tables // from `creature_addon` and `creature_template_addon`tables

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11572" #define REVISION_NR "11573"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__