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).

For each building of the settlement (primary, port, then the others), every armed citizenry group of its level gives one unit: 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.

§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.