[6982] Implemented gmlevel-based command security
[getmangos.git] / src / game / UpdateData.h
blobaff6d47e5d65b47c3a5f7bf452219d69d52036f2
1 /*
2 * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
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.
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.
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
19 #ifndef __UPDATEDATA_H
20 #define __UPDATEDATA_H
22 class WorldPacket;
24 enum OBJECT_UPDATE_TYPE
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
34 enum OBJECT_UPDATE_FLAGS
36 UPDATEFLAG_NONE = 0x00,
37 UPDATEFLAG_SELF = 0x01,
38 UPDATEFLAG_TRANSPORT = 0x02,
39 UPDATEFLAG_HAS_TARGET = 0x04,
40 UPDATEFLAG_LOWGUID = 0x08,
41 UPDATEFLAG_HIGHGUID = 0x10,
42 UPDATEFLAG_LIVING = 0x20,
43 UPDATEFLAG_HAS_POSITION = 0x40,
44 UPDATEFLAG_VEHICLE = 0x80
47 class UpdateData
49 public:
50 UpdateData();
52 void AddOutOfRangeGUID(std::set<uint64>& guids);
53 void AddOutOfRangeGUID(const uint64 &guid);
54 void AddUpdateBlock(const ByteBuffer &block);
55 bool BuildPacket(WorldPacket *packet, bool hasTransport = false);
56 bool HasData() { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
57 void Clear();
59 std::set<uint64> const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; }
61 protected:
62 uint32 m_blockCount;
63 std::set<uint64> m_outOfRangeGUIDs;
64 ByteBuffer m_data;
66 void Compress(void* dst, uint32 *dst_size, void* src, int src_size);
68 #endif