small hotkey::HOTKEY_ENDTURN refactor

This commit is contained in:
gfgtdf 2024-03-07 01:17:44 +01:00
parent e3bf4dcb3f
commit 1453142579
2 changed files with 3 additions and 6 deletions

View file

@ -50,9 +50,7 @@ bool playmp_controller::hotkey_handler::can_execute_command(const hotkey::ui_com
case hotkey::HOTKEY_ENDTURN:
if (linger())
{
bool has_next_scenario = !gamestate().gamedata_.next_scenario().empty() &&
gamestate().gamedata_.next_scenario() != "null";
return playmp_controller_.is_host() || !has_next_scenario;
return playmp_controller_.is_host() || !gamestate().has_next_scenario();
}
else
{

View file

@ -228,9 +228,8 @@ bool playsingle_controller::hotkey_handler::can_execute_command(const hotkey::ui
case hotkey::HOTKEY_RECALL:
return (!browse() || whiteboard_manager_->is_active()) && !linger() && !events::commands_disabled;
case hotkey::HOTKEY_ENDTURN:
//TODO: Its unclear to me under which cirumstances the other clients can remain in linger mode
// when the host pressed scenario, some codes suggest that tha can be the case some don't.
return (!browse() || (linger() && playsingle_controller_.is_host())) && !events::commands_disabled;
//playmp_controller::hotkey_handler checks whether we are the host.
return (!browse() || linger()) && !events::commands_disabled;
case hotkey::HOTKEY_DELAY_SHROUD:
return !linger()