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

Consistency: When changing economy from smooth to default recalculate prod_level instead ofusing0x10 #3164

Closed
DorpsGek opened this issue Sep 1, 2009 · 2 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Sep 1, 2009

SirkoZ opened the ticket and wrote:

Rev.: trunk and release

Desc.:
A player starts a game with smooth_economy ON.
Connects a local coal mine to a power station.
Coal mine through the years increases to 1200 tonnes per month (production_rate = 150).
This same player then, out of curiosity, changes economy from smooth to default (during the game progressing).
Little does he know that with his flip of the economy change switch to default, default (starting) prod_level (=0x10) has been assigned to "his" 1200t coal mine.
Upon first production change (let's say it's a decrease) of "his" connected coal mine, he is appalled to find out that production has decreased to 64t per month (prod_rate of 8 and prod_level of 0x8).

There is consistency the other way around (if one switches from default to smooth_econ - production rates get changed from their current values).
So in the event of smooth -> default switch, every prod_rate[0] and [1] should be checked and prod_level set according to the highest of the two following these rules:
if (prod_rate >= indspec->prod_rate * 8)
prod_level = 0x80;
if (prod_rate >= indspec->prod_rate * 4 && prod_rate < indspec->prod_rate * 8)
prod_level = 0x40;
if (prod_rate >= indspec->prod_rate * 2 && prod_rate < indspec->prod_rate * 4)
prod_level = 0x20;
if (prod_rate >= indspec->prod_rate * 1 && prod_rate < indspec->prod_rate * 2)
prod_level = 0x10;
if (prod_rate >= indspec->prod_rate / 2 && prod_rate < indspec->prod_rate * 1)
prod_level = 0x8;
if (prod_rate >= indspec->prod_rate / 4 && prod_rate < indspec->prod_rate / 2)
prod_level = 0x4;
To not instantly close eventual less than (indspec->prod_rate / 4) industries such prod_rate could be upgraded to indspec->prod_rate / 4. :-)

This should add consistency although I can't imaginge anyone wanting to go from smooth_economy to default other than out of curiosity. :-)

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/3164
@DorpsGek
Copy link
Member Author

andythenorth wrote:

LordAro has a patch for this :P


This comment was imported from FlySpray: https://bugs.openttd.org/task/3164#comment14640

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) labels Apr 7, 2018
@andythenorth
Copy link
Contributor

Let's pass on this. Although there's a patch for it, there are bigger fish to fry eh? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

2 participants