For those new to the show, I'm coding FIRS, and I'm using this thread and the #openttd irc for solving nfo problems (/me being slightly better at drawing than coding).
Problem #1.
Background:
- I am coding production boosting cargos (Engineering Supplies and Farm Supplies).
- Pretty much all FIRS industries use the production callback for gradual processing.
- I am using the monthly random production change to increase production multiplier if the correct supplies are waiting to be processed.
Problem:
My implementation works just fine when the production callback processes 0 units per month. When I start processing the cargo, often there is no cargo remaining by the time the production change callback runs, so no increase.
For various gameplay reasons, I cannot simply process the cargo very slowly, nor do I want to require that players deliver a lot of cargo

Question:
Could I store a flag in a register? This would be set by the production callback if cargo is present, then used (and cleared) by the monthly production change callback.
If that's a valid idea, how on earth might I do it?

Code: Select all
//Iron Ore Mine
-1 * 0 00 0A \b8 01 IND_IRONOREMINE //-1 * 0 00 0A <num-props> 01 <id>
08 12 //substitute industry type
09 12 //industry type override
11 CARGO_ENGINEERINGSUPPLIES FF FF FF //acceptance cargo types (dword; fill unused with FFh)
1C 00 00 00 00 //input cargo 1 multiplier (dword M1 M2; output_typen = X*Mn/256)
17 \b5 //probability in random game
18 \b2 //probability during gameplay
21 B4 //callback flags
22 01 //callback flags
//To show cargo waiting to be processed at industry, ensure prop 21 is set to use production callback
//No action 1 for industries, as graphics are defined by the industry-tile feature.
-1 * 0 02 0A 00 //Production callback
00 //version
\w12 \w0 \w0 //<subtract-in-1..3>
\w0 \w0 //<add-out-1..2>
00 //don't repeat
-1 * 0 02 0A C2 //Random production increase if engineering supplies stockpiled...
81 18 00 03
\b1 //range
0E 80 00 00 //lookat cb 35 or 29 in wiki to see what the returned value means
00 80 //else no change
-1 * 0 02 0A C1 //Handle cb 35 monthly production change
85 40 00 FF FF //check cargo waiting
\b1 // range
C2 00 01 00 FF FF
00 80 //else do the standard random production change as if this industry was a primary one.
-1 * 0 02 0A C0 //Callback 38 display additional text in fund window
85 0C //<type> <variable> word-access callback
00 FF FF //no shift, no mask
\b4 //number of ranges to check
00 80 29 00 29 00 //monthly production change cb 29
C1 00 35 00 35 00 //monthly production change cb 35
STR_INFO_GENERIC 80 38 00 38 00 //return text-ID D0xx if cb 38 (fund window)
STR_INFO_GENERIC 80 3A 00 3A 00 //return text-ID D0xx if cb 3A (industry window)
\w0 //default
//Industry action 3 attach varaction2 chain to industry
-1 * 0 03 0A 01 IND_IRONOREMINE 00 \wxC0 //-1 * 0 03 09 <n-ids> <id> 00 <def-cid>