Files
Blitz/include/blitz/protocol/packets/UpdateGameStatePacket.h
Persson-dev 74aac7a03a
Some checks failed
Linux arm64 / Build (push) Failing after 1m58s
begin splib migration
2025-02-23 13:26:33 +01:00

61 lines
1.6 KiB
C++

#pragma once
/**
* \file UpdateGameStatePacket.h
* \brief File containing the blitz::protocol::UpdateGameStatePacket class
*/
#include "blitz/game/Game.h"
#include <sp/default/DefaultPacket.h>
#include <sp/protocol/Field.h>
#include <sp/protocol/MessageBase.h>
namespace blitz {
namespace protocol {
enum class UpdateGameStateFieldsE {
m_GameState = 0,
m_TimeRemaining,
};
using UpdateGameStateFields = std::tuple<
game::GameState, //<- m_GameState
std::uint64_t //<- m_TimeRemaining
>;
/**
* \class UpdateGameStatePacket
* \brief Packet for updating the game state.
* %Packet structure :
* | PacketType |
* |-----------------------------|
* | PacketType::UpdateGameState |
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|----------------------------------------------|
* | Game State | GameState | The new game state |
* | Time Remaining | std::uint64_t | The time remaining in the current game state |
*/
DeclarePacket(UpdateGameState){
public:
PacketConstructor(UpdateGameState)
/**
* \brief Get the new game state.
* \return The new game state.
*/
game::GameState GetGameState() const {
return GetField<UpdateGameStateFieldsE, UpdateGameStateFieldsE::m_GameState>();
}
/**
* \brief Get the time remaining in the current game state.
* \return The time remaining in the current game state.
*/
std::uint64_t GetTimeRemaining() const {
return GetField<UpdateGameStateFieldsE, UpdateGameStateFieldsE::m_TimeRemaining>();
}
};
} // namespace protocol
} // namespace blitz