[2] | 1 | /* |
---|
| 2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
| 3 | * |
---|
| 4 | * This program is free software; you can redistribute it and/or modify |
---|
| 5 | * it under the terms of the GNU General Public License as published by |
---|
| 6 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | * (at your option) any later version. |
---|
| 8 | * |
---|
| 9 | * This program is distributed in the hope that it will be useful, |
---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | * GNU General Public License for more details. |
---|
| 13 | * |
---|
| 14 | * You should have received a copy of the GNU General Public License |
---|
| 15 | * along with this program; if not, write to the Free Software |
---|
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | #ifndef __UPDATEDATA_H |
---|
| 20 | #define __UPDATEDATA_H |
---|
| 21 | |
---|
| 22 | class WorldPacket; |
---|
| 23 | |
---|
| 24 | enum OBJECT_UPDATE_TYPE |
---|
| 25 | { |
---|
| 26 | UPDATETYPE_VALUES = 0, |
---|
| 27 | UPDATETYPE_MOVEMENT = 1, |
---|
| 28 | UPDATETYPE_CREATE_OBJECT = 2, |
---|
| 29 | UPDATETYPE_CREATE_OBJECT2 = 3, |
---|
| 30 | UPDATETYPE_OUT_OF_RANGE_OBJECTS = 4, |
---|
| 31 | UPDATETYPE_NEAR_OBJECTS = 5 |
---|
| 32 | }; |
---|
| 33 | |
---|
| 34 | enum OBJECT_UPDATE_FLAGS |
---|
| 35 | { |
---|
| 36 | UPDATEFLAG_NONE = 0x00, |
---|
| 37 | UPDATEFLAG_SELF = 0x01, |
---|
| 38 | UPDATEFLAG_TRANSPORT = 0x02, |
---|
| 39 | UPDATEFLAG_FULLGUID = 0x04, |
---|
| 40 | UPDATEFLAG_LOWGUID = 0x08, |
---|
| 41 | UPDATEFLAG_HIGHGUID = 0x10, |
---|
| 42 | UPDATEFLAG_LIVING = 0x20, |
---|
| 43 | UPDATEFLAG_HASPOSITION = 0x40 |
---|
| 44 | }; |
---|
| 45 | |
---|
| 46 | class UpdateData |
---|
| 47 | { |
---|
| 48 | public: |
---|
| 49 | UpdateData(); |
---|
| 50 | |
---|
| 51 | void AddOutOfRangeGUID(std::set<uint64>& guids); |
---|
| 52 | void AddOutOfRangeGUID(const uint64 &guid); |
---|
| 53 | void AddUpdateBlock(const ByteBuffer &block); |
---|
| 54 | bool BuildPacket(WorldPacket *packet, bool hasTransport = false); |
---|
| 55 | bool HasData() { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); } |
---|
| 56 | void Clear(); |
---|
| 57 | |
---|
| 58 | std::set<uint64> const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; } |
---|
| 59 | |
---|
| 60 | protected: |
---|
| 61 | uint32 m_blockCount; |
---|
| 62 | std::set<uint64> m_outOfRangeGUIDs; |
---|
| 63 | ByteBuffer m_data; |
---|
| 64 | |
---|
| 65 | void Compress(void* dst, uint32 *dst_size, void* src, int src_size); |
---|
| 66 | }; |
---|
| 67 | #endif |
---|