AI: Improve attacker danger evaluation
Added a patch, tested on master, depends on #46029.
A line not rebased slipped in, fixed. 3.1 patch coming. IDK will I do a 3.0 patch here.
Patches are ready.
"This patch includes a generic mechanism for arbitrary requirement vector evaluation (i.e., substituting is_req_active() with a custom callback)."
Could you split that to a separate patch? So that unrelated functionalities would not be tied to acceptance (schedule) of this patch. I didn't look it closely, but noticed that you have parameters with _sz -suffix in their name, but which are not of type size_t. Should they?
On a tree with this applied, clang analyzer gives (at leas some of this from tri_req_active_turns() added by this patch):
../../../src/common/requirements.c:5146:9: warning: Value stored to 'present' is never read [deadcode.DeadStores]
../../../src/common/requirements.c:5147:9: warning: Value stored to 'present1' is never read [deadcode.DeadStores]
../../../src/common/requirements.c:5153:9: warning: Value stored to 'present' is never read [deadcode.DeadStores]
../../../src/common/requirements.c:5155:9: warning: Value stored to 'present1' is never read [deadcode.DeadStores]
Ping.
As far as I know, this is the "root dependency" for all the other open patches from you, and I'm a bit worried that the whole stack catches bitrot (stops applying)
Reply To cazfi
Ping.
Sorry, don't have much time for now, but I'll try to sort this one out in few days.
Patch for 3.2 after split to #46266 is added, 3.1 coming soon
New 3.1 patch done.
Firstly, consider "Attack_bonus" effect. Then, pay a heed to action enablers, maybe they prohibit the attack. Also, don't consider harmless units that can't attack but can occupy the city.
Actually, a split from #41781 since the patch grew too big.