[8677] Move most client update data functions to object itself from ObjectAccessor.

Also use virtual function BuildUpdateData (old ObjectAccessor::_buildUpdateObject)
that different for world objects and items.
This commit is contained in:
VladimirMangos 2009-10-19 15:00:28 +04:00
parent a2ff999fd3
commit abb77cfdbf
7 changed files with 73 additions and 79 deletions

View file

@ -148,6 +148,7 @@ class MANGOS_DLL_SPEC Object
virtual void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const;
void SendCreateUpdateToPlayer(Player* player);
virtual void BuildUpdateData(UpdateDataMapType& update_players) =0;
void BuildValuesUpdateBlockForPlayer( UpdateData *data, Player *target ) const;
void BuildOutOfRangeUpdateBlock( UpdateData *data ) const;
void BuildMovementUpdateBlock( UpdateData * data, uint32 flags = 0 ) const;
@ -307,8 +308,9 @@ class MANGOS_DLL_SPEC Object
virtual void _SetUpdateBits(UpdateMask *updateMask, Player *target) const;
virtual void _SetCreateBits(UpdateMask *updateMask, Player *target) const;
void _BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2 ) const;
void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target ) const;
void BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2 ) const;
void BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target ) const;
void BuildUpdateDataForPlayer(Player* pl, UpdateDataMapType& update_players);
uint16 m_objectType;
@ -339,8 +341,12 @@ class MANGOS_DLL_SPEC Object
Object& operator=(Object const&); // prevent generation assigment operator
};
struct WorldObjectChangeAccumulator;
class MANGOS_DLL_SPEC WorldObject : public Object
{
friend struct WorldObjectChangeAccumulator;
public:
virtual ~WorldObject ( ) {}
@ -488,11 +494,11 @@ class MANGOS_DLL_SPEC WorldObject : public Object
//this function should be removed in nearest time...
Map const* GetBaseMap() const;
Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime);
void BuildUpdateData(UpdateDataMapType &);
Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime);
protected:
explicit WorldObject();
std::string m_name;
//these functions are used mostly for Relocate() and Corpse/Player specific stuff...
//use them ONLY in LoadFromDB()/Create() funcs and nowhere else!
@ -500,6 +506,8 @@ class MANGOS_DLL_SPEC WorldObject : public Object
void SetLocationMapId(uint32 _mapId) { m_mapId = _mapId; }
void SetLocationInstanceId(uint32 _instanceId) { m_InstanceId = _instanceId; }
std::string m_name;
private:
Map * m_currMap; //current object's Map location