feat: added GameRoot::get_game_mode and a get_game_state shorthand

stripped
Sara 2024-03-20 09:43:48 +01:00
parent c85947f187
commit 51c9090d10
2 changed files with 10 additions and 0 deletions

View File

@ -138,6 +138,14 @@ void GameRoot::set_game_mode(Ref<GameMode> prototype) {
} while(new_player_id != 0); } while(new_player_id != 0);
} }
Ref<GameMode> GameRoot::get_game_mode() const {
return this->game_mode;
}
Ref<GameState> GameRoot::get_game_state() const {
return this->game_mode->get_game_state();
}
IPlayer *GameRoot::spawn_player(uint32_t id) { IPlayer *GameRoot::spawn_player(uint32_t id) {
UtilityFunctions::push_error("GameRoot::spawn_player not implemented"); UtilityFunctions::push_error("GameRoot::spawn_player not implemented");
return nullptr; return nullptr;

View File

@ -45,6 +45,8 @@ public:
// override the current gamemode // override the current gamemode
// force-respawns all players // force-respawns all players
void set_game_mode(Ref<GameMode> prototype); void set_game_mode(Ref<GameMode> prototype);
Ref<GameMode> get_game_mode() const;
Ref<GameState> get_game_state() const;
protected: protected:
// attempt to make 'this' the current singleton instance // attempt to make 'this' the current singleton instance
void grab_singleton(); void grab_singleton();