-
-
Notifications
You must be signed in to change notification settings - Fork 960
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
Feature: Industry production graph #7575
Conversation
kiwitreekor
commented
May 7, 2019
•
edited
Loading
edited
- This patch adds a window showing industry production history in last 24 months. (which already exists in Chris Sawyer's Locomotion)
Commit checker found some whitespace problems:
|
889a104
to
af3332c
Compare
Should be fixed in 889a104. |
af3332c
to
966b7cd
Compare
966b7cd
to
ee7478d
Compare
ee7478d
to
a1f6475
Compare
This needs to be updated as the savegame version as been bumped. |
Currently display units for weight and volume are ignored, which is not ideal. This will also affect how the graph scales, and I'm not sure how it should handle oil rigs which have passengers tens and oil in the tens of thousands of litres. |
Another issue, graphs are not being redrawn properly on new a month, leading to visual glitches. |
a1f6475
to
d7eea7d
Compare
Now rebased to e7f6f07. |
d7eea7d
to
754eb30
Compare
Now graphs are set dirty in |
754eb30
to
400135d
Compare
hmm... maybe should I limit the number of showing cargoes to one at once? |
I don't think that's useful. The player can do that themselves with the filter anyway. |
bump? |
400135d
to
bb5d93f
Compare
Sorry for late reply... |
bb5d93f
to
69a95a5
Compare
bump |
30299e5
to
d470426
Compare
d470426
to
f6c21f6
Compare
Rebased for review. We can squash my merge commit when fixing stuff or merging. |
Sorry @kiwitreekor, I rebased and it no longer works. (I think because of other changes to the codebase since you last updated this, not because of the rebase itself.) Do you plan to update this for review, or should I try to update it myself? |
@2TallTyler Sorry for late reply. I don't have enough time to update code now.. so could you update the code? |
Sure, I'll try to fix and update. |
Month isn't really a good period to measure production though. IIRC there can be 8 or 9 production cycles in one month making it look like there was a production change on the chart when there was none. |
What period would you suggest instead? I have not tested savegame size increases, but 5,000 industries sounds like a stress-test more than a typical usecase. |
3d0cfbf
to
956be74
Compare
I don't really know what would be the best period. As I can see there are 3 options:
I quickly checked and a regular |
Thinking a bit more about it, maybe game can split produced cargo between two months when calculating production for cycles that happen to cover both. |
956be74
to
fc0c134
Compare
fc0c134
to
bfbdf61
Compare
bfbdf61
to
a3df54f
Compare
I rebased from 4dd7f62 (to start with a clean base) |
/* Redraw box if lowered */ | ||
if (lowered) DrawFrameRect(r.left, y, r.right, y + this->line_height - 1, COLOUR_ORANGE, lowered ? FR_LOWERED : FR_NONE); | ||
|
||
byte clk_dif = lowered ? 1 : 0; | ||
int rect_x = clk_dif + (rtl ? r.right - 12 : r.left + WidgetDimensions::scaled.framerect.left); | ||
|
||
GfxFillRect(rect_x, y + clk_dif, rect_x + 8, y + 5 + clk_dif, PC_BLACK); | ||
GfxFillRect(rect_x + 1, y + 1 + clk_dif, rect_x + 7, y + 4 + clk_dif, cs->legend_colour); | ||
SetDParam(0, cs->name); |
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.
There's a cleaner implementation of this in PaymentRatesGraphWindow::DrawWidget
which should be used instead.
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_IP_ENABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_ENABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_ENABLE_ALL), SetFill(1, 0), | ||
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_IP_DISABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_DISABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_DISABLE_ALL), SetFill(1, 0), | ||
NWidget(NWID_SPACER), SetMinimalSize(0, 4), | ||
NWidget(NWID_HORIZONTAL), | ||
NWidget(WWT_MATRIX, COLOUR_ORANGE, WID_IP_MATRIX), SetResize(0, 2), SetMatrixDataTip(1, 0, STR_GRAPH_CARGO_PAYMENT_TOGGLE_CARGO), SetScrollbar(WID_IP_MATRIX_SCROLLBAR), | ||
NWidget(NWID_VSCROLLBAR, COLOUR_ORANGE, WID_IP_MATRIX_SCROLLBAR), |
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.
In the similar Cargo Payment Rates GUI, these are all COLOUR_BROWN to match the window background.
Was messing around with fixing requested changes locally and find out strange behavior: when you have both cargo payment rates and production graph windows opened clicking on cargo in an any legend will toggle it and it's graph on both windows (and it will be very laggy in a cargo payment rates window). I don't think that it's an intended behavior so I fixed it by simply adding But maybe it'll be a good idea to rename I also rebased it on a recent master. |
I agree that this is not intended behavior. Good catch. Yes, you'll have to open a new PR to continue development. Since the original author hasn't touched this PR in two years, it shouldn't be a problem (like the source code, PRs are GPL-licensed so you wouldn't need permission no matter the timeline). |
superceded by #10541 |