feat: GameRoot now calls GameMode::_begin and _end
parent
a8153c3ec4
commit
af4208f3b7
|
@ -122,6 +122,7 @@ void GameRoot::set_game_mode(Ref<GameMode> 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<GameMode> 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);
|
||||
|
|
Loading…
Reference in New Issue