As an other step towards getting a town growth challenge setting in trunk, I've written a patch that adds new town demand settings. For those of you who don't know, check the Spinoff link in my signature. In a nutshell: the aim is to add a goal to playing OpenTTD, in particular the growing of towns.
When one of the town demand patch settings is chosen, it changes the demands of towns to the given selection. The demand is enforced on all towns on the map, regardless of location or climate.
A new setting is added in Economy / Towns, called Town Demand. There are 8 settings that can be chosen, beyond the default behaviour:
- Food and Water
- Goods and Valuables
- Food, Water and Goods
- Food, Water, Goods and Valuables
- Food, Water, Goods, Valuables and TE_DEMAND1 (displayed as 'Other' in the menu)
- Food, Water, Goods, Valuables, TE_DEMAND1 and TE_DEMAND2
- TE_DEMAND1 and TE_DEMAND2
The patch introduces three new town effect values for cargoes.
- TE_VALUABLES attributed to Valuables, Diamonds and Gold, substitute type 0x0A
- TE_DEMAND1, needs setting by a cargo newgrf, substitute type 0x19
- TE_DEMAND2, needs setting by a cargo newgrf, substitute type 0x1D
Current cargo demand formulas:
- TE_FOOD: t->population / 100;
- TE_WATER: max(((population / 150) - 5), 0);
- TE_GOODS: max(((population / 200) - 10), 0);
- TE_VALUABLES: max(((population / 300) - 10), 0);
- TE_DEMAND1: max(((population / 350) - 15), 0);
- TE_DEMAND2: max(((population / 400) - 20), 0);
* with town demands on, towns are limited to 6,553,500 population for settings 1,2 and 4-7. For setting 3 the limit is 13,109,000 and for setting 8 it is 22,942,500. These limits are due to the cargo amount being stored in a 16 bit unsigned integer, so delivering more cargo will just roll over to 0 and fail to meet the demand. The numbers are the maximum population that can be serviced by 65535 units of cargo delivered, using the above formulas.
* in Toyland, Toys now have effect TE_WATER, to supplement Fizzy Drinks (TE_FOOD) and Candy (TE_GOODS). This allows playing with settings 1, 2 and 4 in toyland without newgrfs. Due to the bad building zone assignments in Toyland, growing big cities there is quite a challenge!
Diff versus r23012
updated binary: now with lang files (!)