Project

General

Profile

Actions

Bug #2481

open

AI: hunters don't attack

Added by Sweet Tea Dorminy 1 day ago. Updated about 8 hours ago.

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

0%

Estimated time:

Description

dai_hunter_manage() skips a target when !unit_attack_unit_at_tile_result(...) holds. That function returns enum unit_attack_result, and ATT_OK is 0, so the test is true exactly when the hunter can attack the target, and the hunter considers only targets it cannot attack.

In practice no hunter takes a target. eval_hunter_want() runs the same code on a virtual unit, so the AI never builds a unit to hunt with either (only hard and cheating levels build hunters; the others have H_TARGETS). That is every Hunter-role unit: in classic Horsemen, Chariot, Knights, Dragoons, Cavalry, Armor, Frigate, Ironclad, Destroyer and Submarine; civ2civ3 has Elephants and Crusaders in place of the Chariot.

The check came in with osdn #46176 (Dec 2022, against a segfault when nothing on the tile could be attacked) and is in 2.6.8, 3.0.5, 3.1.0 and every 3.2 release.

Attached patch compares with ATT_OK. A tile with nothing to attack, which the check was added for, is still skipped. main and S3_3 share one patch; S3_2 has its own for aihunt.c. Might collide with #2461


Files


Related issues 1 (1 open — 0 closed)

Blocked by Feature #2461: daihunter.c : NULL -> nullptrIn ReviewMarko Lindqvist11/08/2026

Actions
Actions #1

Updated by Marko Lindqvist about 19 hours ago

Sweet Tea Dorminy wrote:

Might collide with #2461

It does - or at least this does not apply on top of my work branch for some reason.

Actions #2

Updated by Marko Lindqvist about 19 hours ago

Actions #4

Updated by Marko Lindqvist about 8 hours ago

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

Also available in: Atom PDF