| | | 9 | /* Behaviour:
|
|---|
| | | 10 | * Industry is constructed with 'storage 0' set to 512, which means 100%.
|
|---|
| | | 11 | * GS sets 'storage 0' via command.
|
|---|
| | | 12 | * Actual production modifier is: (1 + storage0/256) / 3
|
|---|
| | | 13 | * storage0 = 0 -> 33%
|
|---|
| | | 14 | * storage0 = 256 -> 66%
|
|---|
| | | 15 | * storage0 = 512 -> 100%
|
|---|
| | | 16 | * storage0 = 1024 -> 166%
|
|---|
| | | 17 | * Special value:
|
|---|
| | | 18 | * Adding 0x10000 to storage0 announces closure and closes the industry next month.
|
|---|
| | | 19 | */
|
|---|
| | | 20 |
|
|---|
| | | 21 | produce (primary_produce,
|
|---|
| | | 22 | 0, 0, 0,
|
|---|
| | | 23 | production_rate_1 * (LOAD_PERM(0) & 0xFFFF) / 256,
|
|---|
| | | 24 | production_rate_2 * (LOAD_PERM(0) & 0xFFFF) / 256,
|
|---|
| | | 25 | );
|
|---|
| | | 26 |
|
|---|
| | | 27 | switch (FEAT_INDUSTRIES, SELF, monthly_check), [
|
|---|
| | | 28 | LOAD_PERM(0) >> 16
|
|---|
| | | 29 | ]) {
|
|---|
| | | 30 | 1: return CB_RESULT_IND_PROD_CLOSE;
|
|---|
| | | 31 | 0: return CB_RESULT_IND_PROD_NO_CHANGE;
|
|---|
| | | 32 | }
|
|---|
| | | 33 |
|
|---|
| | | 34 | switch (FEAT_INDUSTRIES, SELF, switch_prod_change, [
|
|---|
| | | 35 | STORE_PERM(extra_callback_info1, 0),
|
|---|
| | | 36 | extra_callback_info1
|
|---|
| | | 37 | ]) {
|
|---|
| | | 38 | return CB_RESULT_IND_PROD_CLOSE;
|
|---|
| | | 39 | }
|
|---|
| | | 40 |
|
|---|
| | | 41 | switch (FEAT_INDUSTRIES, SELF, init_industry, [
|
|---|
| | | 42 | STORE_PERM(512, 0),
|
|---|
| | | 43 | extra_callback_info1
|
|---|
| | | 44 | ]) {
|
|---|
| | | 45 | return 16;
|
|---|
| | | 46 | }
|
|---|
| | | 47 |
|
|---|