From 7d82e57b91dee30e0fe6fed36550ea7cc9eb778e Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Fri, 22 Jul 2022 16:31:13 +0200 Subject: network: Move global state into a seperate class Co-Authored-By: Narr the Reg <5944268+german77@users.noreply.github.com> --- src/network/network.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/network/network.h') diff --git a/src/network/network.h b/src/network/network.h index 6d002d693..74eb42bf5 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -10,16 +10,25 @@ namespace Network { -/// Initializes and registers the network device, the room, and the room member. -bool Init(); +class RoomNetwork { +public: + RoomNetwork(); -/// Returns a pointer to the room handle -std::weak_ptr GetRoom(); + /// Initializes and registers the network device, the room, and the room member. + bool Init(); -/// Returns a pointer to the room member handle -std::weak_ptr GetRoomMember(); + /// Returns a pointer to the room handle + std::weak_ptr GetRoom(); -/// Unregisters the network device, the room, and the room member and shut them down. -void Shutdown(); + /// Returns a pointer to the room member handle + std::weak_ptr GetRoomMember(); + + /// Unregisters the network device, the room, and the room member and shut them down. + void Shutdown(); + +private: + std::shared_ptr g_room_member; ///< RoomMember (Client) for network games + std::shared_ptr g_room; ///< Room (Server) for network games +}; } // namespace Network -- cgit v1.2.3