OregonCore  revision 3611e8a-git
Your Favourite TBC server
WorldPacket.h
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef OREGONCORE_WORLDPACKET_H
19 #define OREGONCORE_WORLDPACKET_H
20 
21 #include "Common.h"
22 #include "ByteBuffer.h"
23 
24 class WorldPacket : public ByteBuffer
25 {
26  public:
27  // just container for later use
29  {
30  }
31  explicit WorldPacket(uint16 opcode, size_t res = 200) : ByteBuffer(res), m_opcode(opcode) { }
32  // copy constructor
33  WorldPacket(const WorldPacket& packet) : ByteBuffer(packet), m_opcode(packet.m_opcode)
34  {
35  }
36 
37  void Initialize(uint16 opcode, size_t newres = 200)
38  {
39  clear();
40  _storage.reserve(newres);
41  m_opcode = opcode;
42  }
43 
44  uint16 GetOpcode() const
45  {
46  return m_opcode;
47  }
48  void SetOpcode(uint16 opcode)
49  {
50  m_opcode = opcode;
51  }
52 
53  protected:
55 };
56 #endif
57 
uint16 GetOpcode() const
Definition: WorldPacket.h:44
uint16 m_opcode
Definition: WorldPacket.h:54
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:37
WorldPacket(const WorldPacket &packet)
Definition: WorldPacket.h:33
std::vector< uint8 > _storage
Definition: ByteBuffer.h:507
WorldPacket(uint16 opcode, size_t res=200)
Definition: WorldPacket.h:31
ACE_UINT16 uint16
Definition: Define.h:72
void clear()
Definition: ByteBuffer.h:73
void SetOpcode(uint16 opcode)
Definition: WorldPacket.h:48