From 23be33492e67f789f720b33508e592df7c4c2aab Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Thu, 21 Feb 2019 09:44:16 +0100 Subject: [PATCH] Small fixes. --- common/include/core/Registry.hpp | 2 +- common/include/network/ISerializable.hpp | 2 ++ common/include/world/World.hpp | 2 ++ server/include/network/ServerInfo.hpp | 21 +++++++++++---------- server/include/world/ServerBlock.hpp | 2 +- server/include/world/ServerWorld.hpp | 2 +- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/common/include/core/Registry.hpp b/common/include/core/Registry.hpp index d68f9315..a6ac5d25 100644 --- a/common/include/core/Registry.hpp +++ b/common/include/core/Registry.hpp @@ -23,7 +23,7 @@ #include "Network.hpp" #include "Recipe.hpp" -struct Client; +class Client; class Registry : public ISerializable { public: diff --git a/common/include/network/ISerializable.hpp b/common/include/network/ISerializable.hpp index a5d01b13..3fb5c24d 100644 --- a/common/include/network/ISerializable.hpp +++ b/common/include/network/ISerializable.hpp @@ -18,6 +18,8 @@ namespace sf { class Packet; } class ISerializable { public: + virtual ~ISerializable() = default; + virtual void serialize(sf::Packet &packet) = 0; virtual void deserialize(sf::Packet &packet) = 0; }; diff --git a/common/include/world/World.hpp b/common/include/world/World.hpp index 3a80334b..aeceedac 100644 --- a/common/include/world/World.hpp +++ b/common/include/world/World.hpp @@ -20,6 +20,8 @@ class World { public: + virtual ~World() = default; + virtual BlockData *getBlockData(int x, int y, int z) const = 0; virtual u16 getBlock(int x, int y, int z) const = 0; diff --git a/server/include/network/ServerInfo.hpp b/server/include/network/ServerInfo.hpp index b0ba89d3..462f0b3a 100644 --- a/server/include/network/ServerInfo.hpp +++ b/server/include/network/ServerInfo.hpp @@ -24,21 +24,22 @@ #include "NetworkInputHandler.hpp" -struct Client { - Client(u16 _id, sf::IpAddress _address, u16 _port, const std::shared_ptr &socket) - : id(_id), address(_address), port(_port), tcpSocket(socket) {} +class Client { + public: + Client(u16 _id, sf::IpAddress _address, u16 _port, const std::shared_ptr &socket) + : id(_id), address(_address), port(_port), tcpSocket(socket) {} - u16 id; - bool isReady = false; + u16 id; + bool isReady = false; - sf::IpAddress address; - u16 port; + sf::IpAddress address; + u16 port; - u32 previousKeyTimestamp = 0; + u32 previousKeyTimestamp = 0; - std::shared_ptr tcpSocket; + std::shared_ptr tcpSocket; - NetworkInputHandler inputHandler; + NetworkInputHandler inputHandler; }; class ServerInfo { diff --git a/server/include/world/ServerBlock.hpp b/server/include/world/ServerBlock.hpp index 985f6b42..0297dc35 100644 --- a/server/include/world/ServerBlock.hpp +++ b/server/include/world/ServerBlock.hpp @@ -16,7 +16,7 @@ #include "Block.hpp" -struct Client; +class Client; class Server; class ServerBlock : public Block { diff --git a/server/include/world/ServerWorld.hpp b/server/include/world/ServerWorld.hpp index 6ade0545..5e325820 100644 --- a/server/include/world/ServerWorld.hpp +++ b/server/include/world/ServerWorld.hpp @@ -20,7 +20,7 @@ #include "ServerChunk.hpp" #include "World.hpp" -struct Client; +class Client; class Server; class ServerPlayer;