From e4483eca01b48b943cd0461e24a74ae1a3139ed4 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Wed, 12 Feb 2025 21:57:46 +1100 Subject: Update to most recent version (old initial commit) --- src/server/client.hh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/server/client.hh') diff --git a/src/server/client.hh b/src/server/client.hh index 5866035..4a2c1fd 100644 --- a/src/server/client.hh +++ b/src/server/client.hh @@ -9,10 +9,10 @@ #include #include "server/chunk_data.hh" -#include "server/world.hh" +#include "server/world/chunk.hh" +#include "shared/entity/player.hh" #include "shared/net/connection.hh" -#include "shared/player.hh" -#include "shared/world.hh" +#include "shared/world/chunk.hh" namespace server { @@ -44,14 +44,21 @@ public: decltype(&shared::world::chunk::equal)> chunks{4096, shared::world::chunk::hash, shared::world::chunk::equal}; + // sequence of the client's last commands, used for prediction + shared::tick_t sequence = 0u; + public: client(shared::net::connection&& con, const shared::player::index_t& index) : connection(std::move(con)), index(index) {} + bool is_in_pvs(const client& other) const noexcept; + + // Not safe to use getter functions without checking has_initalised. bool has_initialised() const noexcept { return this->player_info.has_value(); } - shared::player& get_player() noexcept { + + shared::player& get_player() const noexcept { return (*this->player_info)->player; } const std::string& get_username() const noexcept { -- cgit v1.2.3