military

military.uniform_indiv_choice

<bitfield-type type-name="uniform_indiv_choice">
  <flag-bit name="any"/>
  <flag-bit name="melee"/>
  <flag-bit name="ranged"/>
</bitfield-type>

military.item_filter_spec

<struct-type type-name="item_filter_spec">
  <enum base-type="int16_t" name="item_type" type-name="item_type"/>
  <int16_t name="item_subtype" refers-to="(item-subtype-target
      $$._parent.item_type $)"/>
  <enum base-type="int16_t" name="material_class"
      type-name="entity_material_category"/>
  <int16_t name="mattype" ref-target="material"
      aux-value="$$.matindex"/>
  <int32_t name="matindex"/>
</struct-type>

military.squad_uniform_spec

<struct-type type-name="squad_uniform_spec">
  <int32_t name="item" ref-target="item"/>
  <compound name="item_filter" type-name="item_filter_spec"/>
  <int32_t name="color"/>
  <stl-vector name="assigned">
    <int32_t ref-target="item"/>
  </stl-vector>
  <compound name="indiv_choice" type-name="uniform_indiv_choice"/>
</struct-type>

military.squad_ammo_spec

<struct-type type-name="squad_ammo_spec">
  <compound name="item_filter" type-name="item_filter_spec"/>
  <int32_t name="amount"/>
  <bitfield name="flags" base-type="uint32_t">
    <flag-bit name="use_combat"/>
    <flag-bit name="use_training"/>
  </bitfield>
  <stl-vector name="assigned">
    <int32_t ref-target="item"/>
  </stl-vector>
</struct-type>

military.squad_use_flags

<bitfield-type type-name="squad_use_flags" base-type="uint32_t">
  <flag-bit name="sleep"/>
  <flag-bit name="train"/>
  <flag-bit name="indiv_eq"/>
  <flag-bit name="squad_eq"/>
</bitfield-type>

military.uniform_category

<enum-type type-name="uniform_category" base-type="int16_t">
  <enum-item name="body"/>
  <enum-item name="head"/>
  <enum-item name="pants"/>
  <enum-item name="gloves"/>
  <enum-item name="shoes"/>
  <enum-item name="shield"/>
  <enum-item name="weapon"/>
</enum-type>

military.uniform_flags

<bitfield-type type-name="uniform_flags" base-type="uint32_t">
  <flag-bit name="replace_clothing"/>
  <flag-bit name="exact_matches"/>
</bitfield-type>

military.barrack_preference_category

<enum-type type-name="barrack_preference_category">
  <enum-item name="Bed"/>
  <enum-item name="Armorstand"/>
  <enum-item name="Box"/>
  <enum-item name="Cabinet"/>
</enum-type>

military.squad_event_type

<enum-type type-name="squad_event_type" base-type="int16_t">
  <enum-item name="None" value="-1"/>
  <enum-item name="Unk0"/>
  <enum-item name="Unk1"/>
  <enum-item name="Unk2"/>
</enum-type>

military.squad_position

<struct-type type-name="squad_position">
  <int32_t name="occupant" ref-target="historical_figure"/>
  <stl-vector name="orders" pointer-type="squad_order"/>
  <static-array name="preferences" count="4"
      index-enum="barrack_preference_category">
    <stl-vector type-name="int32_t" ref-target="building"/>
  </static-array>
  <static-array name="uniform" count="7"
      index-enum="uniform_category">
    <stl-vector pointer-type="squad_uniform_spec"/>
  </static-array>
  <stl-string name="unk_c4"/>
  <compound name="flags" type-name="uniform_flags"/>
  <stl-vector name="assigned_items">
    <int32_t ref-target="item"/>
  </stl-vector>
  <int32_t name="quiver" ref-target="item"/>
  <int32_t name="backpack" ref-target="item"/>
  <int32_t name="flask" ref-target="item"/>
  <static-array name="activities" count="3"
      index-enum="squad_event_type" type-name="int32_t"
      ref-target="activity_entry"/>
  <static-array name="events" count="3" index-enum="squad_event_type"
      type-name="int32_t" ref-target="activity_event"
      aux-value="$._global.activities[$._key]"/>
  <int32_t name="unk_118"/>
  <int32_t name="unk_11c"/>
</struct-type>

military.squad_schedule_order

<struct-type type-name="squad_schedule_order">
  <pointer name="order" type-name="squad_order"/>
  <int32_t name="min_count"/>
  <stl-bit-vector name="positions"/>
</struct-type>

military.squad_schedule_entry

<struct-type type-name="squad_schedule_entry">
  <stl-string name="name"/>
  <int16_t name="sleep_mode">
    0 room, 1 barrack will, 2 barrack need
  </int16_t>
  <int16_t name="uniform_mode">
    0 uniformed, 1 civ clothes
  </int16_t>
  <stl-vector name="orders" pointer-type="squad_schedule_order"/>
  <stl-vector name="order_assignments"
      index-refers-to="$$._global._upglobal.positions[$]">
    -- weird change to pointer to int in v0.34.01
    <pointer>
      <int32_t refers-to="$$._parent._parent._parent.orders[$]"/>
    </pointer>
  </stl-vector>
</struct-type>

military.squad

<struct-type type-name="squad" key-field="id"
    instance-vector="$global.world.squads.all">
  <int32_t name="id"/>
  <compound name="name" type-name="language_name"/>
  <stl-string name="alias">
    if not empty, used instead of name
  </stl-string>
  <stl-vector name="positions" pointer-type="squad_position"/>
  <stl-vector name="orders" pointer-type="squad_order"/>
  <stl-vector name="schedule">
    <pointer>
      <static-array count="12" type-name="squad_schedule_entry"/>
    </pointer>
  </stl-vector>
  <int32_t name="cur_alert_idx" refers-to="$$._parent.schedule[$]"
      init-value="0"/>
  <stl-vector name="rooms">
    <pointer>
      <int32_t name="building_id" ref-target="building"/>
      <compound name="mode" type-name="squad_use_flags"/>
    </pointer>
  </stl-vector>
  <stl-vector name="rack_combat" type-name="int32_t"
      ref-target="building"/>
  <stl-vector name="rack_training" type-name="int32_t"
      ref-target="building"/>
  <int32_t name="uniform_priority"/>
  <int32_t name="activity" ref-target="activity_entry"/>
  <stl-vector name="ammunition" pointer-type="squad_ammo_spec"/>
  <stl-vector name="train_weapon_free">
    <int32_t ref-target="item"/>
  </stl-vector>
  <stl-vector name="train_weapon_inuse">
    <int32_t ref-target="item"/>
  </stl-vector>
  <stl-vector name="ammo_items">
    <int32_t ref-target="item"/>
  </stl-vector>
  <stl-vector name="ammo_units">
    <int32_t ref-target="unit"/>
  </stl-vector>
  <int16_t name="carry_food"/>
  <int16_t name="carry_water"/>
  <int32_t name="entity_id" ref-target="historical_entity">
    v0.40.01
  </int32_t>
  <int32_t name="leader_position" refers-to="(find-by-id
      $$._global.entity_id.ref-target.positions.own $id $)">
    v0.40.01
  </int32_t>
  <int32_t name="leader_assignment" refers-to="(find-by-id
      $$._global.entity_id.ref-target.positions.assignments $id $)">
    v0.40.01
  </int32_t>
</struct-type>

military.squad_order_type

<enum-type type-name="squad_order_type">
  <enum-item name="MOVE"/>
  <enum-item name="KILL_LIST"/>
  <enum-item name="DEFEND_BURROWS"/>
  <enum-item name="PATROL_ROUTE"/>
  <enum-item name="TRAIN"/>
  <enum-item name="DRIVE_ENTITY_OFF_SITE"/>
  <enum-item name="CAUSE_TROUBLE_FOR_ENTITY"/>
</enum-type>

military.squad_order_cannot_reason

<enum-type type-name="squad_order_cannot_reason">
  text in viewscreen_unitlistst
  <enum-item name="not_following_order"/>
  <enum-item name="activity_cancelled"/>
  <enum-item name="no_barracks"/>
  <enum-item name="improper_barracks"/>
  <enum-item name="no_activity"/>
  <enum-item name="cannot_individually_drill"/>
  <enum-item name="does_not_exist"/>
  <enum-item name="no_archery_target"/>
  <enum-item name="improper_building"/>
  <enum-item name="unreachable_location"/>
  <enum-item name="invalid_location"/>
  <enum-item name="no_reachable_valid_target"/>
  <enum-item name="no_burrow"/>
  <enum-item name="not_in_squad"/>
  <enum-item name="no_patrol_route"/>
  <enum-item name="no_reachable_point_on_route"/>
  <enum-item name="invalid_order"/>
</enum-type>

military.squad_order

<class-type type-name="squad_order" original-name="squad_orderst">
  <int32_t name="unk_v40_1" init-value="-1">
    v0.40.01
  </int32_t>
  <int32_t name="unk_v40_2" init-value="-1">
    v0.40.01
  </int32_t>
  <int32_t name="year">
    v0.40.01
  </int32_t>
  <int32_t name="year_tick">
    v0.40.01
  </int32_t>
  <int32_t name="unk_v40_3">
    v0.40.01
  </int32_t>
  <virtual-methods>
    <vmethod name="clone">
      <ret-type>
        <pointer type-name="squad_order"/>
      </ret-type>
    </vmethod>
    <vmethod name="write_file">
      <pointer name="file" type-name="file_compressorst"/>
    </vmethod>
    <vmethod name="read_file">
      <pointer name="file" type-name="file_compressorst"/>
      <int32_t name="loadversion"/>
    </vmethod>
    <vmethod ret-type="squad_order_type" name="getType"/>
    <vmethod name="isPatrol" ret-type="bool"/>
    <vmethod is-destructor="true"/>
    <vmethod name="offsetPosition">
      <int16_t/>
      <int16_t/>
      <int16_t/>
    </vmethod>
    <vmethod ret-type="bool" name="process">
      <int32_t/>
      <int32_t/>
      <pointer name="soldier" type-name="unit"/>
    </vmethod>
    <vmethod ret-type="squad_order_cannot_reason" name="reasonCannot">
      <pointer name="soldier" type-name="unit"/>
    </vmethod>
    <vmethod ret-type="bool" name="decUniformLock">
      <pointer name="soldier" type-name="unit"/>
    </vmethod>
    <vmethod name="isFulfilled" ret-type="bool">
      v0.34.11; true if all killed
    </vmethod>
    <vmethod name="getTargetUnits">
      <ret-type>
        <pointer>
          <stl-vector type-name="int32_t"/>
        </pointer>
      </ret-type>
    </vmethod>
    <vmethod ret-type="int16_t" name="getUniformType">
      <pointer name="soldier" type-name="unit"/>
    </vmethod>
    <vmethod name="getDescription">
      <pointer type-name="stl-string"/>
    </vmethod>
    <vmethod name="isInactive" ret-type="bool">
      <int32_t/>
      always false
    </vmethod>
    <vmethod name="isCombat" ret-type="bool">
      not train
    </vmethod>
  </virtual-methods>
</class-type>

military.squad_order_movest

<class-type type-name="squad_order_movest"
    inherits-from="squad_order">
  <compound name="pos" type-name="coord"/>
  <int32_t name="point_id"/>
</class-type>

military.squad_order_kill_listst

<class-type type-name="squad_order_kill_listst"
    inherits-from="squad_order">
  <stl-vector name="units">
    <int32_t ref-target="unit"/>
  </stl-vector>
  <stl-vector name="histfigs">
    <int32_t ref-target="historical_figure"/>
  </stl-vector>
  <stl-string name="title"/>
</class-type>

military.squad_order_defend_burrowsst

<class-type type-name="squad_order_defend_burrowsst"
    inherits-from="squad_order">
  <stl-vector name="burrows" type-name="int32_t" ref-target="burrow"/>
</class-type>

military.squad_order_patrol_routest

<class-type type-name="squad_order_patrol_routest"
    inherits-from="squad_order">
  <int32_t name="route_id"/>
</class-type>

military.squad_order_trainst

<class-type type-name="squad_order_trainst"
    inherits-from="squad_order"/>

military.squad_order_drive_entity_off_sitest

<class-type type-name="squad_order_drive_entity_off_sitest"
    inherits-from="squad_order">
  <int32_t/>
  <int32_t/>
  <stl-string/>
</class-type>

military.squad_order_cause_trouble_for_entityst

<class-type type-name="squad_order_cause_trouble_for_entityst"
    inherits-from="squad_order">
  <int32_t/>
  <stl-string/>
</class-type>

military.army_controller

<struct-type type-name="army_controller" key-field="id"
    instance-vector="$global.world.army_controllers.all">
  <int32_t name="id"/>
  <int32_t name="entity_id" ref-target="historical_entity"/>
  <int32_t name="unk_8"/>
  <int32_t name="pos_x"/>
  <int32_t name="pos_y"/>
  <int32_t name="unk_14"/>
  <int32_t name="unk_18"/>
  <stl-vector name="unk_1c"/>
  <int32_t name="year"/>
  <int32_t name="year_tick"/>
  <int32_t name="unk_34"/>
  <int32_t name="unk_38"/>
  <int32_t name="unk_3c"/>
  <int32_t name="unk_40"/>
  <stl-vector name="unk_44"/>
  <int32_t name="unk_54"/>
  <pointer name="unk_58">
    target structure varies
  </pointer>
  <int32_t name="type"/>
</struct-type>

military.army_flags

<enum-type type-name="army_flags">
  <enum-item name="player"/>
</enum-type>

military.army

<struct-type type-name="army" key-field="id"
    instance-vector="$global.world.armies.all">
  <int32_t name="id"/>
  <compound type-name="coord" name="pos"/>
  <compound type-name="coord" name="last_pos"/>
  <int16_t name="unk_10"/>
  <int32_t name="unk_14"/>
  <int32_t name="unk_18"/>
  <stl-vector name="members">
    <pointer>
      <int32_t name="nemesis_id"/>
      <int32_t name="unk_4"/>
      <int32_t name="unk_8"/>
      <int32_t name="unk_c"/>
      <int32_t name="unk_10"/>
      <int32_t name="unk_14"/>
      <int32_t name="unk_18"/>
      <int32_t name="unk_1c" init-value="-1000000"/>
      <int32_t name="unk_20" init-value="-1000000"/>
      <int32_t name="unk_24" init-value="-1000000"/>
      <int32_t name="unk_28"/>
      <int32_t name="unk_2c"/>
      <int32_t name="unk_30"/>
      <int32_t name="unk_34"/>
      <stl-vector name="unk_38"/>
      <int32_t name="unk_v42_1">
        v0.42.01
      </int32_t>
    </pointer>
  </stl-vector>
  <stl-vector name="unk_2c">
    <pointer>
      <int32_t name="count"/>
      <int32_t name="race"/>
      <int32_t name="population_id"/>
      <int32_t name="civ_id"/>
      <int32_t name="unk_10"/>
      <int32_t name="cultural_identity"/>
      <int32_t name="unk_18"/>
      <int32_t name="unk_1c"/>
      <int32_t name="unk_20"/>
      <int32_t name="unk_24"/>
      <int32_t name="unk_28"/>
    </pointer>
  </stl-vector>
  <int32_t name="unk_3c"/>
  <int32_t name="controller_id" ref-target="army_controller"/>
  <pointer name="controller" type-name="army_controller"/>
  <df-flagarray name="flags" index-enum="army_flags"/>
  <stl-vector name="unk_pos_x" type-name="int32_t"/>
  <stl-vector name="unk_pos_y" type-name="int32_t"/>
  <stl-vector name="unk_70" type-name="int32_t"/>
  <stl-vector name="unk_80" type-name="int32_t"/>
  <int32_t name="unk_90"/>
  <int32_t name="unk_94"/>
  <int32_t name="unk_98"/>
  <int32_t name="unk_9c"/>
  <int32_t name="unk_a0"/>
  <int32_t name="unk_a4"/>
  <stl-vector name="unk_a8"/>
  <stl-vector name="creature_class" pointer-type="stl-string"/>
  <enum type-name="item_type" base-type="int16_t" name="item_type"/>
  <int16_t name="item_subtype" refers-to="(item-subtype-target
      $$._parent.item_type $)"/>
  <int16_t name="mat_type" ref-target="material"
      aux-value="$$.mat_index"/>
  <int32_t name="mat_index"/>
</struct-type>