FS#3164  Consistency: When changing economy from smooth to default recalculate prod_level instead ofusing0x10
Attached to Project:
OpenTTD
Opened by SirkoZ (SirkoZ)  Tuesday, 01 September 2009, 13:45 GMT
Last edited by JeanFrancois Claeys (Belugas)  Tuesday, 01 September 2009, 15:17 GMT
Opened by SirkoZ (SirkoZ)  Tuesday, 01 September 2009, 13:45 GMT
Last edited by JeanFrancois Claeys (Belugas)  Tuesday, 01 September 2009, 15:17 GMT

DetailsRev.: 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. :) 
This task depends upon
Comment by andythenorth (andythenorth) 
Friday, 25 August 2017, 11:18 GMT
LordAro has a patch for this :P