Actions
Bug #2452
openAI builds diplomat for any military threat.
Start date:
11/08/2026
Due date:
% Done:
0%
Estimated time:
Description
city_data->diplomat_threat is documented as "Enemy diplomat or spy is
near the city" (daicity.h), and is the sole trigger for
dai_choose_diplomat_defensive()'s 16000 want, which outranks every
military build.
However, assess_danger() set it for any unit, by checking utype_acts_hostile(). ACTION_HOSTILE is true of attackers, pillagers, bombarders and city conquerors just as much as spies, so an approaching Warriors made the city buy a Diplomat before a defender -- a poor life choice.
It should test as others do: dai_choose_diplomat_defensive() answers with best_role_unit(pcity, UTYF_DIPLOMAT) and count_diplomats_on_tile() counts UTYF_DIPLOMAT, so the threat is raised by UTYF_DIPLOMAT units only.
Files
Actions