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