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

[1858] Make sure tokens from Madrid privates go to the right city #10042

Merged
merged 3 commits into from
Dec 30, 2023

Conversation

ollybh
Copy link
Collaborator

@ollybh ollybh commented Dec 27, 2023

Catch a corner case: if any of the Madrid private railway companies are being acquired by, or used to start, a public company and one of the other Madrid cities is empty and unreserved (after another Madrid private closed without their slot being taken), then the player can select either the city for the private being acquired or the empty city. Only the first of these is a legal choice.

These tokens use the pending_tokens mechanism. This is implemented by adding a cities field to this hash, and checking that the city chosen is included.

Fixes #9858.

The only game that I could find that will need pinning is 137962, the one where this bug was reported.

  • Branch is derived from the latest master
  • Add the pins 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

Catch a corner case: if any of the Madrid private railway companies are being
acquired by a public company and one of the other Madrid slots is empty and
unreserved (after another Madrid private closed without their slot being taken),
then the player can select either the slot for the private being acquired or the
empty slot. Only the first of these is a legal choice.

Fixes tobymao#9858.
An improved fix for tobymao#9858.

The issue with a token being placed in the wrong Madrid city can occur
both when a private railway company is acquired by a public company, and
also when a public company is formed from a private railway company.

This fixes the latter, ensuring that the home token can only be placed
in a city where the private railway company held a reservation.
@ollybh ollybh added pins PR that will require some games to be pinned 1858 labels Dec 27, 2023
@michaeljb michaeljb merged commit 72a158e into tobymao:master Dec 30, 2023
1 check passed
@ollybh ollybh deleted the fix-issue-9858 branch February 22, 2024 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1858 pins PR that will require some games to be pinned
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1858] Token from private railway can be placed in unreserved Madrid slot
2 participants