blob: 3dc50bde23da3ee6fe31c8931c3b3e1e2d75e61e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __UPDATEDATA_H
#define __UPDATEDATA_H
#include "Define.h"
#include "ByteBuffer.h"
#include "ObjectGuid.h"
#include <set>
class WorldPacket;
enum OBJECT_UPDATE_TYPE
{
UPDATETYPE_VALUES = 0,
UPDATETYPE_CREATE_OBJECT = 1,
UPDATETYPE_CREATE_OBJECT2 = 2,
UPDATETYPE_OUT_OF_RANGE_OBJECTS = 3,
};
class UpdateData
{
public:
UpdateData(uint32 map);
UpdateData(UpdateData&& right) noexcept : m_map(right.m_map), m_blockCount(right.m_blockCount),
m_outOfRangeGUIDs(std::move(right.m_outOfRangeGUIDs)),
m_data(std::move(right.m_data))
{
}
void AddDestroyObject(ObjectGuid guid);
void AddOutOfRangeGUID(GuidSet& guids);
void AddOutOfRangeGUID(ObjectGuid guid);
void AddUpdateBlock() { ++m_blockCount; }
ByteBuffer& GetBuffer() { return m_data; }
bool BuildPacket(WorldPacket* packet);
bool HasData() const { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty() || !m_destroyGUIDs.empty(); }
void Clear();
GuidSet const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; }
protected:
uint32 m_map;
uint32 m_blockCount;
GuidSet m_destroyGUIDs;
GuidSet m_outOfRangeGUIDs;
ByteBuffer m_data;
UpdateData(UpdateData const& right) = delete;
UpdateData& operator=(UpdateData const& right) = delete;
};
#endif
|