-
Notifications
You must be signed in to change notification settings - Fork 187
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
[1849] modification to code for variants #11417
base: master
Are you sure you want to change the base?
[1849] modification to code for variants #11417
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks fine to me. I don't think that this should break any existing games as the steps will be skipped if the variants aren't selected. But leave the pins tag in place to make sure that this gets tested before the code is deployed.
bonds? ? G1849::Step::BondInterestPayment : nil, | ||
bonds? ? G1849::Step::Bond : nil, | ||
G1849::Step::BondInterestPayment, | ||
G1849::Step::Bond, | ||
[Engine::Step::BuyCompany, { blocks: true }], | ||
].compact, round_num: round_num) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don´t need to compact
the array any more, as it will not contain any nils.
].compact, round_num: round_num) | |
], round_num: round_num) |
@@ -30,7 +30,12 @@ def description | |||
end | |||
|
|||
def log_skip(entity) | |||
super if @game.bonds? && @game.issue_bonds_enabled | |||
print "hi #{can_take_loan?(entity)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A stray debugging statement has made it through to the pull request.
print "hi #{can_take_loan?(entity)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of small fixes are needed before this gets merged.
Hopefully fixes issues with Variants rules. I'll manually close the bug reports after confirming. (see below)
Before clicking "Create"
master
pins
orarchive_alpha_games
label if this change will break existing gamesdocker compose exec rack rubocop -a
docker compose exec rack rake
Implementation Notes
Explanation of Change
Players trying the variants have all encountered variations of this error at various points:
Often, refreshing and trying again and again seems to resolve the issue temporarily, but that's obviously not a solution. This issue has proven difficult to troubleshoot, since it doesn't happen in Hotseat mode, or even when playing multiplayer on my local environment.
I tried changing the code for def operating_round, removing the logic that gates the inclusion of the variant steps, and instead adding
log_pass
andlog_skip
methods to those steps to mask those steps unless using the variants.Once I did this, rake would fail on the fixture files, which I found interesting since the fixture doesn't use the variants. I went through the logic of the variants themselves, and added a gate to the
def actions
to return [] if that variant isn't active.That resolved the Rake error, and I still seem to be able to play through local games, so at worst this is no worse than the current state, and I think the code is cleaner and closer to the standard code seen throughout the site.
Screenshots
Any Assumptions / Hacks
This may well require archiving/pinning any games using the Bonds/Electric Dreams/Buy Tokens variants, but I don't believe it would affect other games of 1849.