Expand description
CitizenAIComponent: choosing what a citizen does next. See docs/CITIZEN-AI.md.
Original: FUN_140115040.
Modules§
- activity
- Activities.
Structs§
- Citizen
Ai - A citizen’s AI: the cooldown of each activity, the current and queued activity, and the urgent flags.
- Citizen
View - The citizen values candidate building reads (
D= CitizenDescription). - Thresholds
- The CitizenDescription thresholds candidate building reads.
Functions§
- candidates
- Candidate activities in push order, and whether the list is shuffled and sorted (the doctor-only and urgent-only lists return before that).
- crt_
qsort - The MSVC CRT
qsortinlined for candidates, ordering by priority, highest first (comparatorb.priority - a.priority). Median of three, short sort (selection of the maximum) for 8 or fewer elements, smaller partition first. - crt_
qsort_ by - The same with a three-way comparator.
- crt_
qsort_ less - The Microsoft C runtime’s
qsortwith alesscomparator, as the game’s templated copies use it: the same algorithm ascrt_qsort_by, withcmp(a, b) > 0beingless(b, a)and equality neither way. - shuffle_
and_ sort - Swap each position with
Rand(count), then sort.
Type Aliases§
- Candidate
- One candidate (12-byte entries: activity, priority, unused).