Difference between revisions of "Callback: Random production change"
m (Create a separate page for each callback) |
(unify naming to "production level") |
||
(One intermediate revision by one other user not shown) | |||
Line 4: | Line 4: | ||
{| |- |
{| |- |
||
− | !Value!! |
+ | !Value!!Version!!Meaning |
|- |
|- |
||
− | |00||Do nothing|| |
+ | |00||{{ottdp| | }}||Do nothing|| |
|- |
|- |
||
− | |01||Halve industry production. If production goes below the quarter of the default, the industry is closed instead, as if you returned 03.|| |
+ | |01||{{ottdp| | }}||Halve industry production. If production goes below the quarter of the default, the industry is closed instead, as if you returned 03.|| |
|- |
|- |
||
− | |02||Double industry production if it hasn't reached eight times of the original yet.|| |
+ | |02||{{ottdp| | }}||Double industry production if it hasn't reached eight times of the original yet.|| |
|- |
|- |
||
− | |03||The industry announces imminent closure, and is physically removed from the map next month.|| |
+ | |03||{{ottdp| | }}||The industry announces imminent closure, and is physically removed from the map next month.|| |
|- |
|- |
||
− | |04||Do the standard random production change as if this industry was a primary one.|| |
+ | |04||{{ottdp| | }}||Do the standard random production change as if this industry was a primary one.|| |
|- |
|- |
||
− | |05||Divide production by 4|| |
+ | |05||{{ottdp| | }}||Divide production by 4|| |
|- |
|- |
||
− | |06||Divide production by 8|| |
+ | |06||{{ottdp| | }}||Divide production by 8|| |
|- |
|- |
||
− | |07||Divide production by 16|| |
+ | |07||{{ottdp| | }}||Divide production by 16|| |
|- |
|- |
||
− | |08||Divide production by 32|| |
+ | |08||{{ottdp| | }}||Divide production by 32|| |
|- |
|- |
||
− | |09||Multiply production by 4|| |
+ | |09||{{ottdp| | }}||Multiply production by 4|| |
|- |
|- |
||
− | |0A||Multiply production by 8|| |
+ | |0A||{{ottdp| | }}||Multiply production by 8|| |
|- |
|- |
||
− | |0B||Multiply production by 16|| |
+ | |0B||{{ottdp| | }}||Multiply production by 16|| |
|- |
|- |
||
− | |0C||Multiply production by 32|| |
+ | |0C||{{ottdp| | }}||Multiply production by 32|| |
|- |
|- |
||
− | |0D||Decrement production by 1 |
+ | |0D||{{ottdp|0.6|2.6|ottdrev=r11532|ttdprev=r2046}}||Decrement production by 1 |
|- |
|- |
||
− | |0E||Increment production by 1 |
+ | |0E||{{ottdp|0.6|2.6|ottdrev=r11532|ttdprev=r2046}}||Increment production by 1 |
|- |
|- |
||
− | |0F||Set production as returned in bits 16..23 of register 0x100 (clamped to 4..128) |
+ | |0F||{{ottdp|0.7|2.6|ottdrev=r14561|ttdprev=r2068}}||Set production as returned in bits 16..23 of register 0x100 (clamped to 4..128) |
|} |
|} |
||
Line 47: | Line 47: | ||
above 8 times of the original will only increase it to that value. |
above 8 times of the original will only increase it to that value. |
||
− | Since r1306, you can override the default news messages that appear after production changes. To do this, you must set bit 8 of the |
+ | Since TTDPatch r1306, you can override the default news messages that appear after production changes. To do this, you must set bit 8 of the |
returned result, and put the textID into the low word of GRF register 100h (the high word of the register is ignored). |
returned result, and put the textID into the low word of GRF register 100h (the high word of the register is ignored). |
||
The textID can be of a default TTD text or a DCxx text; it '''cannot''' be a D0xx text. If the given action generates a message, |
The textID can be of a default TTD text or a DCxx text; it '''cannot''' be a D0xx text. If the given action generates a message, |
||
Line 55: | Line 55: | ||
change the production multiplier, but are still important enough to require a news message. |
change the production multiplier, but are still important enough to require a news message. |
||
− | Using return values 0Dh, 0Eh and 0Fh you can adjust production |
+ | Using return values 0Dh, 0Eh and 0Fh you can adjust production level more smoothly. The production level is a value between 04h and 80h |
(initial value 10h). Returning 0Dh when the production is at 4 will close the industry. But returning 0Fh will never close the industry, |
(initial value 10h). Returning 0Dh when the production is at 4 will close the industry. But returning 0Fh will never close the industry, |
||
instead the value is clamped to the allowed range. |
instead the value is clamped to the allowed range. |
Latest revision as of 17:15, 28 April 2012
Random production change (29)
Called when TTD chooses the industry for a random production change. Variable 18 contains 32 random bits to help randomizing the decision. The callback must return one of the following results:
Since TTDPatch 2.5 beta 1, you can set bit 7 of this value to suppress the news message announcing the production change. Be careful with this, especially for closedown messages; most players wouldn't like those being suppressed.
For return values 05..0C, the double/halve news messages are displayed. You should probably replace the defaults with some text that doesn't explicitly say "double" or "halve", or use the message override feature (see below). If a divide operation brings the production below the quarter of the default, the industry is closed down instead. Multiply operations that would bring the production above 8 times of the original will only increase it to that value.
Since TTDPatch r1306, you can override the default news messages that appear after production changes. To do this, you must set bit 8 of the returned result, and put the textID into the low word of GRF register 100h (the high word of the register is ignored). The textID can be of a default TTD text or a DCxx text; it cannot be a D0xx text. If the given action generates a message, it will be the one you specified. It may, however, not generate messages at all; for example, operation 04 may decide not to change the production, and then your message won't be shown. There is one exception: operation 00 would never generate a message, but it still will when bit 8 is set. This is useful in conjunction with callback 35, to tell the player about things that don't change the production multiplier, but are still important enough to require a news message.
Using return values 0Dh, 0Eh and 0Fh you can adjust production level more smoothly. The production level is a value between 04h and 80h (initial value 10h). Returning 0Dh when the production is at 4 will close the industry. But returning 0Fh will never close the industry, instead the value is clamped to the allowed range. Note that OpenTTD before r15103 did not properly updated production rates provided by properties 12 and 13.