-
Notifications
You must be signed in to change notification settings - Fork 190
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
[18Uruguay] Adding support for delivering goods #10207
[18Uruguay] Adding support for delivering goods #10207
Conversation
c85c88b
to
baeae29
Compare
end | ||
|
||
def ship_capacity(train) | ||
(train.name.scan(/\d/)[0].to_f / 2).ceil |
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.
The train name shouldn't be the source of truth for this data. Regex code generally isn't very readable and since the data is semantically numeric, it should be stored as a number.
Maybe the game class could have a constant mapping train names to the integer value?
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.
Code updated according to recommendation
capacity = ship_capacity(train) | ||
goods_count = [remaining, capacity].min | ||
remaining -= goods_count | ||
train.name += '+' + @game.class::GOODS_TRAIN + '(' + goods_count.to_s + ')' if goods_count.positive? |
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.
Up in attach_good_to_train
, the train name has the hex id included, but here it's the current goods count. Are there some scenarios where it's a hex and others where it's the count?
Maybe instead of in the train name, this changing data about the train could be listed in the corporations status_str
? (that's a method in Game::Base
that's used to show data on the bottom of a player card) I would generally feel better with fewer total modifications made to the train name if possible.
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.
Code updated
9cf631c
to
93cafb0
Compare
Farms will generate goods once per OR which can be delivered to a near by town of city The trains can then ship them to a close by port and then RTPLA can ship them to England This commit covers the delivery both for trains and ships Co-authored-by: Michael Brandt <[email protected]>
93cafb0
to
f1767ef
Compare
Farms will generate goods once per OR which can be delivered to a near by town of city
The trains can then ship them to a close by port and then RTPLA can ship them to England
This commit covers the delivery both for trains and ships
Before clicking "Create"
master
docker compose exec rack rubocop -a
docker compose exec rack rake
Implementation Notes
Explanation of Change
Screenshots
Any Assumptions / Hacks