Skip to main content

Module validation

Module validation 

Source
Expand description

Validation of the tables a startpos is built from, to report why a build would fail before running it.

When the game builds a startpos from broken data it either quits without a startpos, hangs forever, or silently drops rows, and logs nothing. This module finds those problems up front:

  • Every reference of the start_pos_* tables (as the schema defines them) must point to an existing row. Broken references in FATAL_REFERENCES make the game quit or hang, so they’re errors; the rest make it drop the row or ignore the value, so they’re warnings.
  • The campaign must exist.
  • Characters in the generals pool can’t also be placed on the map with an army.
  • Progenitors can’t adopt children under ADULT_AGE: the game gives the adopted child the progenitor’s family name through the child’s character, which children don’t have yet while the families are linked, and crashes.
  • Data the game drops: names whose names.type isn’t their column’s kind, technologies outside the faction’s technology tree, and the non-aggression pacts and military access of vassals with other factions.

The outcomes of broken references were measured on Attila, one broken reference at a time.

Structs§

StartposIssue
A problem in the data a startpos is built from.

Enums§

Severity
How bad an issue is.

Constants§

ADULT_AGE
Age from which characters have a character while the game links their families.
FATAL_REFERENCES
Columns (table without the _tables suffix, column) whose broken references make the game quit or hang while building the startpos. Surname, clan_name and other_name are assumed to behave like Name.

Functions§

referenced_tables
Returns the tables the start_pos_* tables of a schema reference, without the _tables suffix.
validate
Validates the tables a campaign’s startpos is built from.