From af4208f3b7963189876c61d8385f947e904c0c21 Mon Sep 17 00:00:00 2001 From: Sara Date: Thu, 21 Mar 2024 22:49:48 +0100 Subject: [PATCH] feat: GameRoot now calls GameMode::_begin and _end --- game_root.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/game_root.cpp b/game_root.cpp index 210bd2d..0e66495 100644 --- a/game_root.cpp +++ b/game_root.cpp @@ -122,6 +122,7 @@ void GameRoot::set_game_mode(Ref prototype) { // allow "unsetting" the gamemode by passing an invalid gamemode // shorthand for this behaviour is reset_game_mode if(prototype.is_null() || !prototype.is_valid()) { + this->game_mode->_end(); this->game_mode.unref(); return; } @@ -129,6 +130,7 @@ void GameRoot::set_game_mode(Ref prototype) { this->game_mode = prototype->duplicate(false); // .. except for the game state, which should be cloned as well this->game_mode->set_game_state(prototype->get_game_state()->duplicate(false)); + this->game_mode->_begin(); uint32_t new_player_id = this->find_empty_player_slot(); do { IPlayer *player = this->spawn_player(new_player_id);