Bug #2497
openAutoworkers: some tiles lose some value in the worker cache due to type truncation
0%
Description
Since "Autoworkers: Turn tile action values to adv_want" (8ec68126 and 3.2's 8e6f03fd), the worker cache holds adv_want values, but adv_city_worker_extra_set/get() and adv_city_worker_rmextra_set/get() still take and return int.
This hurts tiles with shields, which carry a half point (SHIELD_WEIGHTING / 2), and are therefore deprioritized for roads by autoworkers:
When a worker checks to decide whether build, the cached value of an extra that adds no output gets truncated to int when it's returned, and then compared against the current value. Thus, the extra looks like it makes the tile worse. Doing work to a unused tile is considered only when it makes the tile at least equally good, so making a road is skipped in such a case.
As a result, autoworkers (AI and human alike) leave workers idle even when a road would be worth building for better connectivity.
Attached patch makes the four functions take and return adv_want.
Files