Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18RoyalGorge] Require graph connection for cross-buying trains #11386

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michaeljb
Copy link
Collaborator

From page 13 of 24 in the current rulebook PDF.

Check for the connection when processing the action--instead of when finding available trains to buy--to minimize the necessary graph checks.

Fixes #11364


Pins needed: any games where an illegal (unconnected) cross-buy occurred.

Before clicking "Create"

  • Branch is derived from the latest master
  • Add the pins or archive_alpha_games label if this change will break existing games
  • Code passes linter with docker compose exec rack rubocop -a
  • Tests pass cleanly with docker compose exec rack rake

From page 13 of 24 in the [current rulebook PDF][0].

Check for the connection when processing the action--instead of when finding
available trains to buy--to minimize the necessary graph checks.

Fixes tobymao#11364

[0]: https://boardgamegeek.com/filepage/284918/graphic-rulebook-preliminary
@michaeljb michaeljb added the pins PR that will require some games to be pinned label Dec 1, 2024
@@ -16,6 +16,21 @@ def room?(entity)
# even when train tight, there's room for a self-rust
return true if entity.trains.any? { |t| t.rusts_on == upcoming_train.name }
end

def check_connected!(buyer, train)
return if train.owner == @game.depot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a return if @game.loading guard cause here would remove the need for the game graph to be recalculated when a game is being loaded, at the cost of not rechecking the legality of the move.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
18RoyalGorge pins PR that will require some games to be pinned
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[18RoyalGorge] Prohibit train purchase when companies aren't connected
2 participants