better example

This commit is contained in:
2025-02-18 19:09:40 +01:00
parent baa52d3baa
commit 2eab50932f
4 changed files with 45 additions and 23 deletions

View File

@@ -0,0 +1,30 @@
#pragma once
#include <sp/default/DefaultPacket.h>
#include <sp/protocol/Field.h>
#include <sp/protocol/MessageBase.h>
enum UpgradeTowerPacketFields {
m_Tower = 0,
m_Upgrade,
};
using UpgradeTowerFields = std::tuple<
sp::BitField<std::uint16_t,
sp::Field<std::uint16_t, 12>, //<- m_Tower
sp::Field<std::uint8_t, 4> //<- m_Upgrade
>
>;
DeclarePacket(UpgradeTower){
public:
PacketConstructor(UpgradeTower)
std::uint16_t GetTowerId() const {
return GetField<0>().GetField<m_Tower>();
}
std::uint8_t GetTowerUpgrade() const {
return GetField<0>().GetField<m_Upgrade>();
}
};