From 997e4dd1dcce683f859b4ed6b55290b8d90b3eb4 Mon Sep 17 00:00:00 2001 From: bena Date: Tue, 9 May 2023 14:59:50 +0300 Subject: [PATCH 1/2] fix endgame --- lib/engine/game/g_1880/round/operating.rb | 8 ++++---- lib/engine/round/operating.rb | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/engine/game/g_1880/round/operating.rb b/lib/engine/game/g_1880/round/operating.rb index 65b6566ff5..9e3292d8e9 100644 --- a/lib/engine/game/g_1880/round/operating.rb +++ b/lib/engine/game/g_1880/round/operating.rb @@ -30,13 +30,13 @@ def after_process(action) super end - def after_end_of_turn(_action) - @game.end_game! if trigger_game_end? + def after_end_of_turn(operator) + @game.end_game! if trigger_game_end?(operator) end - def trigger_game_end? + def trigger_game_end?(operator) round_num == @game.final_operating_rounds && - @current_operator == @game.train_marker + operator == @game.train_marker end end end diff --git a/lib/engine/round/operating.rb b/lib/engine/round/operating.rb index ff078242f1..cdeee0378c 100644 --- a/lib/engine/round/operating.rb +++ b/lib/engine/round/operating.rb @@ -46,12 +46,12 @@ def after_process(action) return if entity.owner&.player? || entity.receivership? end - after_end_of_turn(action) + after_end_of_turn(@current_operator) next_entity! unless @game.finished end - def after_end_of_turn(action); end + def after_end_of_turn(operator); end def force_next_entity! @steps.each(&:pass!) @@ -84,7 +84,10 @@ def start_operating @log << "#{@game.acting_for_entity(entity).name} operates #{entity.name}" unless finished? @game.place_home_token(entity) if @home_token_timing == :operate skip_steps - next_entity! if finished? + if finished? + after_end_of_turn(entity) + next_entity! + end end def recalculate_order From 3cf64bdb389417a1c616efac1f0ce825cd87c54e Mon Sep 17 00:00:00 2001 From: bena Date: Tue, 9 May 2023 18:57:58 +0300 Subject: [PATCH 2/2] fix rubo --- lib/engine/round/operating.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/engine/round/operating.rb b/lib/engine/round/operating.rb index cdeee0378c..27afaa357c 100644 --- a/lib/engine/round/operating.rb +++ b/lib/engine/round/operating.rb @@ -84,10 +84,10 @@ def start_operating @log << "#{@game.acting_for_entity(entity).name} operates #{entity.name}" unless finished? @game.place_home_token(entity) if @home_token_timing == :operate skip_steps - if finished? - after_end_of_turn(entity) - next_entity! - end + return unless finished? + + after_end_of_turn(entity) + next_entity! end def recalculate_order