/* * 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 . */ #ifndef __UPDATEDATA_H #define __UPDATEDATA_H #include "Define.h" #include "ByteBuffer.h" #include "ObjectGuid.h" #include 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