Linked and unlinked vector packets

This commit is contained in:
Dan Paulat 2021-12-27 11:59:00 -06:00
parent ab702e9927
commit 96cd27adcb
6 changed files with 237 additions and 151 deletions

View file

@ -26,9 +26,9 @@ public:
LinkedVectorPacket(LinkedVectorPacket&&) noexcept;
LinkedVectorPacket& operator=(LinkedVectorPacket&&) noexcept;
uint16_t packet_code() const;
uint16_t length_of_block() const;
uint16_t value_of_vector() const;
uint16_t packet_code() const;
uint16_t length_of_block() const;
std::optional<uint16_t> value_of_vector() const;
size_t data_size() const override;

View file

@ -0,0 +1,43 @@
#pragma once
#include <scwx/wsr88d/rpg/packet.hpp>
#include <cstdint>
#include <memory>
namespace scwx
{
namespace wsr88d
{
namespace rpg
{
class UnlinkedVectorPacketImpl;
class UnlinkedVectorPacket : public Packet
{
public:
explicit UnlinkedVectorPacket();
~UnlinkedVectorPacket();
UnlinkedVectorPacket(const UnlinkedVectorPacket&) = delete;
UnlinkedVectorPacket& operator=(const UnlinkedVectorPacket&) = delete;
UnlinkedVectorPacket(UnlinkedVectorPacket&&) noexcept;
UnlinkedVectorPacket& operator=(UnlinkedVectorPacket&&) noexcept;
uint16_t packet_code() const;
uint16_t length_of_block() const;
std::optional<uint16_t> value_of_vector() const;
size_t data_size() const override;
bool Parse(std::istream& is) override;
private:
std::unique_ptr<UnlinkedVectorPacketImpl> p;
};
} // namespace rpg
} // namespace wsr88d
} // namespace scwx

View file

@ -1,46 +0,0 @@
#pragma once
#include <scwx/wsr88d/message.hpp>
#include <cstdint>
#include <memory>
namespace scwx
{
namespace wsr88d
{
namespace rpg
{
class Vector2DImpl;
class Vector2D : public Message
{
public:
explicit Vector2D();
~Vector2D();
Vector2D(const Vector2D&) = delete;
Vector2D& operator=(const Vector2D&) = delete;
Vector2D(Vector2D&&) noexcept;
Vector2D& operator=(Vector2D&&) noexcept;
int16_t start_i() const;
int16_t start_j() const;
int16_t end_i() const;
int16_t end_j() const;
size_t data_size() const override;
bool Parse(std::istream& is) override;
static constexpr size_t SIZE = 8u;
private:
std::unique_ptr<Vector2DImpl> p;
};
} // namespace rpg
} // namespace wsr88d
} // namespace scwx