fix: set_game_mode will no longer attempt to spawn a player with id 0 every call
This commit is contained in:
		
							parent
							
								
									7d7e1ac584
								
							
						
					
					
						commit
						92a1cb6bc5
					
				| 
						 | 
				
			
			@ -114,12 +114,12 @@ void GameRoot::set_game_mode(Ref<GameMode> prototype) {
 | 
			
		|||
    this->game_mode = prototype->duplicate(false);
 | 
			
		||||
    // copy the game state from the prototype
 | 
			
		||||
    this->game_mode->set_game_state(prototype->get_game_state()->duplicate(false));
 | 
			
		||||
    uint32_t new_player_id = 0;
 | 
			
		||||
    uint32_t new_player_id = this->find_empty_player_slot();
 | 
			
		||||
    do {
 | 
			
		||||
        new_player_id = this->find_empty_player_slot();
 | 
			
		||||
        IPlayer *player = this->spawn_player(new_player_id);
 | 
			
		||||
        if(player != nullptr)
 | 
			
		||||
            this->initialize_player(player, new_player_id);
 | 
			
		||||
        new_player_id = this->find_empty_player_slot();
 | 
			
		||||
    } while(new_player_id != 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue