summaryrefslogtreecommitdiffstats
path: root/src/network/network.cpp
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2022-07-22 16:31:13 +0200
committerFearlessTobi <thm.frey@gmail.com>2022-07-25 21:59:31 +0200
commit7d82e57b91dee30e0fe6fed36550ea7cc9eb778e (patch)
tree4a58f4874083783026dabc0de6a7fb09195cf95b /src/network/network.cpp
parentcommon: multiplayer: Use GameInfo type (diff)
downloadyuzu-7d82e57b91dee30e0fe6fed36550ea7cc9eb778e.tar
yuzu-7d82e57b91dee30e0fe6fed36550ea7cc9eb778e.tar.gz
yuzu-7d82e57b91dee30e0fe6fed36550ea7cc9eb778e.tar.bz2
yuzu-7d82e57b91dee30e0fe6fed36550ea7cc9eb778e.tar.lz
yuzu-7d82e57b91dee30e0fe6fed36550ea7cc9eb778e.tar.xz
yuzu-7d82e57b91dee30e0fe6fed36550ea7cc9eb778e.tar.zst
yuzu-7d82e57b91dee30e0fe6fed36550ea7cc9eb778e.zip
Diffstat (limited to 'src/network/network.cpp')
-rw-r--r--src/network/network.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 51b5d6a9f..e1401a403 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -9,11 +9,12 @@
namespace Network {
-static std::shared_ptr<RoomMember> g_room_member; ///< RoomMember (Client) for network games
-static std::shared_ptr<Room> g_room; ///< Room (Server) for network games
-// TODO(B3N30): Put these globals into a networking class
+RoomNetwork::RoomNetwork() {
+ g_room = std::make_shared<Room>();
+ g_room_member = std::make_shared<RoomMember>();
+}
-bool Init() {
+bool RoomNetwork::Init() {
if (enet_initialize() != 0) {
LOG_ERROR(Network, "Error initalizing ENet");
return false;
@@ -24,15 +25,15 @@ bool Init() {
return true;
}
-std::weak_ptr<Room> GetRoom() {
+std::weak_ptr<Room> RoomNetwork::GetRoom() {
return g_room;
}
-std::weak_ptr<RoomMember> GetRoomMember() {
+std::weak_ptr<RoomMember> RoomNetwork::GetRoomMember() {
return g_room_member;
}
-void Shutdown() {
+void RoomNetwork::Shutdown() {
if (g_room_member) {
if (g_room_member->IsConnected())
g_room_member->Leave();