diff --git a/lib/engine/game/g_18_bf/game.rb b/lib/engine/game/g_18_bf/game.rb index 273e77d9df..13a1592354 100644 --- a/lib/engine/game/g_18_bf/game.rb +++ b/lib/engine/game/g_18_bf/game.rb @@ -146,6 +146,19 @@ def revenue_for(route, stops) end super + bonuses end + + def check_other(route) + check_london(route) + end + + def check_london(route) + # Can only run to London if running to your own token. + london_stops = route.visited_stops & @london_cities + return if london_stops.all? { |city| city.tokened_by?(current_entity) } + + raise GameError, 'Route may not include London unless running to a ' \ + "#{current_entity.id} token." + end end end end diff --git a/lib/engine/game/g_18_bf/map.rb b/lib/engine/game/g_18_bf/map.rb index d886994d58..246c5b669e 100644 --- a/lib/engine/game/g_18_bf/map.rb +++ b/lib/engine/game/g_18_bf/map.rb @@ -279,6 +279,9 @@ def setup_london_hexes london = @hexes.find { |hex| hex.coordinates == LONDON_HEX_CENTRE } london.neighbors.clear @london_zoomed << london + + # Keep references to the London cities for managing routes. + @london_cities = @london_zoomed.flat_map { |hex| hex.tile.cities } end # Keeps the zoomed London hex colour and city revenue in sync with the