Skip to main content

garrisons

Function garrisons 

Source
pub fn garrisons(
    tables: &StartposTables,
    index: &CampaignIndex,
) -> Result<Vec<Garrison>>
Expand description

Builds the garrisons of every settlement owned by a faction (rebel-owned settlements get none).

Every building_level_armed_citizenry_junctions row, in the table’s key order, gives one unit per building of its level in the settlement: the group’s own unit if the owner’s military group allows it, otherwise the first allowed member of the group. Groups that aren’t units, groups without allowed members and units that can’t move are skipped. The game creates a garrison’s units grouped by key in an order not reproduced yet.

§Arguments

  • tables - Tables with building_level_armed_citizenry_junctions, armed_citizenry_units_to_unit_groups_junctions, units_to_groupings_military_permissions, main_units, land_units and battlefield_engines.
  • index - The campaign’s startpos rows.

§Returns

One garrison per owned settlement, in settlement order.

§Errors

Returns an error if a table or column is missing.