From 51c9090d1043d8b866b69707aa2b428c8bfd0259 Mon Sep 17 00:00:00 2001 From: Sara Date: Wed, 20 Mar 2024 09:43:48 +0100 Subject: [PATCH] feat: added GameRoot::get_game_mode and a get_game_state shorthand --- game_root.cpp | 8 ++++++++ game_root.hpp | 2 ++ 2 files changed, 10 insertions(+) diff --git a/game_root.cpp b/game_root.cpp index 22b5143..3d87f07 100644 --- a/game_root.cpp +++ b/game_root.cpp @@ -138,6 +138,14 @@ void GameRoot::set_game_mode(Ref prototype) { } while(new_player_id != 0); } +Ref GameRoot::get_game_mode() const { + return this->game_mode; +} + +Ref GameRoot::get_game_state() const { + return this->game_mode->get_game_state(); +} + IPlayer *GameRoot::spawn_player(uint32_t id) { UtilityFunctions::push_error("GameRoot::spawn_player not implemented"); return nullptr; diff --git a/game_root.hpp b/game_root.hpp index e34bba0..84c7243 100644 --- a/game_root.hpp +++ b/game_root.hpp @@ -45,6 +45,8 @@ public: // override the current gamemode // force-respawns all players void set_game_mode(Ref prototype); + Ref get_game_mode() const; + Ref get_game_state() const; protected: // attempt to make 'this' the current singleton instance void grab_singleton();