benilla-re systems structs docs

CompareNearbyUnits

function · ui · primitive

Address
0x494450 · 74 bytes, up to 0x494499
Signature
int __cdecl (const void *a, const void *b)
Meaning
Orders two nearby records: in-front first, then ascending squared distance
Confidence
verified, proof one
Finding
ui/targeting#collecting-the-candidates

Finding: Collecting the candidates in ui: selecting a target

The collector 0x494200 runs for every object. It keeps a unit that passes the cached kind's filter, is drawn, and lies within a distance of the player: targetNearestDistance (default 41) when it is in front, targetNearestDistanceRadius (default 10) when it is not. In front is a heading from the player to the unit within 30 degrees of the player's facing, either side. The record stored is the GUID, the squared distance as a float, and the in-front flag. Units of a creature type whose record has bit 0 of +0x28 set are skipped. The sort puts in-front units first and then ascending distance. Both options must lie between 1 and 50.

The derivation is in the doc.

Callers 0

None by a direct call or jump.

Callees 0

None by a direct call or jump.

Calls and jumps by a bare address, from tables/calls.tsv.