Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
WorldPacket.h
Go to the documentation of this file.
1#pragma once
2#ifndef DVD_WORLDPACKET_H
3#define DVD_WORLDPACKET_H
4
5#include "OPCodesTpl.h"
6
7#include "Utils.h"
9
10#include <boost/asio/streambuf.hpp>
11
12namespace Divide {
13
14class WorldPacket : public ByteBuffer {
15 public:
16 WorldPacket() noexcept;
17
18 explicit WorldPacket(const OPCodes::ValueType opCode, const size_t res = 200);
19 void Initialize(const U16 opCode, const size_t newres = 200);
21
22 [[nodiscard]] bool loadFromBuffer(boost::asio::streambuf& buf);
23 [[nodiscard]] bool saveToBuffer(boost::asio::streambuf& buf) const;
24
25
26 /*template <typename Archive>
27 void load(Archive& ar, [[maybe_unused]] const unsigned int version) {
28 size_t storageSize = 0;
29
30 ar& _rpos;
31 ar& _wpos;
32 ar& storageSize;
33
34 _storage.resize(storageSize);
35 for (size_t i = 0; i < storageSize; ++i) {
36 ar & _storage[i];
37 }
38 ar& m_opcode;
39 }
40
41 template <typename Archive>
42 void save(Archive& ar, [[maybe_unused]] const unsigned int version) const {
43 const size_t storageSize = _storage.size();
44
45 ar & _rpos;
46 ar & _wpos;
47 ar & storageSize;
48 for (size_t i = 0; i < storageSize; ++i) {
49 ar & _storage[i];
50 }
51 ar & m_opcode;
52 }*/
53
54};
55
56}; // namespace Divide
57
58#endif //DVD_WORLDPACKET_H
int32_t ValueType
Definition: OPCodesTpl.h:15
WorldPacket() noexcept
Definition: WorldPacket.cpp:8
PROPERTY_RW(OPCodes::ValueType, opcode)
void Initialize(const U16 opCode, const size_t newres=200)
Definition: WorldPacket.cpp:20
bool saveToBuffer(boost::asio::streambuf &buf) const
Definition: WorldPacket.cpp:50
bool loadFromBuffer(boost::asio::streambuf &buf)
Definition: WorldPacket.cpp:27
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint16_t U16