bettola/srv/game/player.h
Ritchie Cunningham ad2a540554 [Refactor] Unify client and server player classes.
A bit of an architectural change before we progress further. Moved
player code into a shared PlayerBass class to elimnate some severe code
duplication while i was getting things working.
2025-09-16 00:10:35 +01:00

28 lines
842 B
C++

#pragma once
#include <netinet/in.h>
#include "bettola/network/tcpsocket.h"
#include "bettola/game/player_base.h"
class Player : public PlayerBase {
public:
Player(BettolaLib::Network::TCPSocket* socket);
void set_udp_addr(const sockaddr_in& addr) { _udp_addr = addr; _has_udp_addr = true; }
BettolaLib::Network::TCPSocket& get_socket(void) const { return *_socket; }
const sockaddr_in& get_udp_addr(void) const { return _udp_addr; }
bool has_udp_addr(void) const { return _has_udp_addr; }
void set_last_processed_sequence(unsigned int sequence) { _last_processed_sequence = sequence; }
unsigned int get_last_processed_sequence(void) const { return _last_processed_sequence; }
private:
BettolaLib::Network::TCPSocket* _socket;
sockaddr_in _udp_addr;
bool _has_udp_addr;
unsigned int _last_processed_sequence;
};