Skip to content

Commit

Permalink
Do not allow adding more than 1 player in title screen level
Browse files Browse the repository at this point in the history
  • Loading branch information
Vankata453 committed Nov 27, 2024
1 parent 4a14433 commit be1fa48
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/supertux/level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,23 @@ Level::initialize(const Statistics::Preferences& stat_preferences)
sector->add<PlayerStatusHUD>(player_status);
}

// All players will be added to the first sector. They are moved between sectors.
Sector* sector = m_sectors.at(0).get();
for (int id = 0; id < InputManager::current()->get_num_users() || id == 0; id++)
sector->add<Player>(player_status, "Tux", 0);

if (savegame && !savegame->is_title_screen())
{
if (!InputManager::current()->has_corresponsing_controller(id)
&& !InputManager::current()->m_uses_keyboard[id]
&& savegame
&& !savegame->is_title_screen()
&& id != 0)
continue;

if (id > 0 && !savegame)
s_dummy_player_status.add_player();

// Add all players in the first sector. They will be moved between sectors.
sector->add<Player>(player_status, "Tux" + (id == 0 ? "" : std::to_string(id + 1)), id);
for (int id = 1; id < InputManager::current()->get_num_users() || id == 0; id++)
{
if (!InputManager::current()->has_corresponsing_controller(id)
&& !InputManager::current()->m_uses_keyboard[id])
continue;

if (!savegame)
s_dummy_player_status.add_player();

sector->add<Player>(player_status, "Tux" + std::to_string(id + 1), id);
}
}
sector->flush_game_objects();
}
Expand Down

0 comments on commit be1fa48

Please sign in to comment.