Project

General

Profile

Actions

Bug #2497

open

Autoworkers: some tiles lose some value in the worker cache due to type truncation

Added by Sweet Tea Dorminy 7 days ago. Updated 6 days ago.

Status:
In Review
Priority:
Normal
Category:
AI
Target version:
Start date:
11/22/2026
Due date:
% Done:

0%

Estimated time:

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

Actions #1

Updated by Marko Lindqvist 6 days ago

  • Status changed from New to In Review
  • Assignee set to Marko Lindqvist
  • Target version set to 3.2.8
Actions

Also available in: Atom PDF