When drawing viewport strings, the StringID is used to determine how to draw the sign. Instead, allow the behaviour to be set by the caller with flags. This means that some of the viewport-specific strings are no longer necessary.
ViewportAddString() now returns a pointer to a string as it may not actually add the string, in which case preparing the string parameters in advance is a waste of time.
The pointer was already captured and converted to a unqiue_ptr, but hidden within the call stack.
This now makes it clearer that the object passed to Add.*NewsItem will become owned by the news item.
Kdtree uses a function pointer and incorrectly calls it a functor. The function pointer needs to be passed on instantiaton.
Instead, use an actual functor. This simplifies instantiation.
Since SetDParamStr() always owns a copy of the string, there is no need to make another copy of it to keep it around while the news item exists.
This also fixes a leak in `CmdIndustrySetProduction` as the allocated data wasn't passed to AddIndustryNewsItem.
Using an actual random chance to generate cities means that there may be far less or far more than 'expected' towns being made as cities.
While this is the point of randomness, the wording of the setting is "Proporation of towns that will become cities: 1 in X" and does not mention randomness at all.
This avoids redundant tile refreshes when the caller has already marked a tile dirty, or knows it does not need refreshing.
Loosely backported from JGRPP.
House picker is accessed from the Landscaping toolbar as there is no town toolbar.
Once placed these houses behave like any other and can be removed by players and towns.
Uses the unified picker system, so also supports used/saved favourites. As town building don't have class labels, town zones are use to imitate them.
Town production effect is modelled on town acceptance (growth) effect, and so takes an original cargo slot for behaviour instead of a direct value.
NewGRF feature 0x0B, property 0x1E, takes 1 byte.
Valid values are:
- 0x00 to behave like passengers
- 0x02 to behave like mail
- 0xFF to behave like other cargo (i.e. not produced.)
If not set, town production effect is set based on the cargo label ('PASS' or 'MAIL').
Town production multiplier allows adjusting the amount of cargo produces when Town Production Effect is set, without needing to use callbacks.
NewGRF feature 0x0B (cargo), property 0x1F, accepts a 2 byte (word) value, similar to the cargo capacity multiplier property. The default value is 256 which means 100%, i.e. normal rate.