add StateMachine

This commit is contained in:
2025-08-09 11:23:17 +02:00
parent ac3e949323
commit cba790f804
23 changed files with 174 additions and 244 deletions

View File

@@ -0,0 +1,23 @@
#pragma once
#include <server/Server.h>
#include <td/misc/SlotGuard.h>
namespace td {
namespace server {
class ServerState : public Server::State, private utils::SlotGuard {
public:
virtual void HandlePacket(PlayerID a_Id, const protocol::PacketBase& a_Packet) = 0;
virtual void Update(float a_Delta) = 0;
ServerState(Server& a_Server);
virtual ~ServerState();
protected:
void SendPacket(PlayerID a_Id, const protocol::PacketBase& a_Packet);
void BroadcastPacket(const protocol::PacketBase& a_Packet);
};
} // namespace server
} // namespace td