Skip to content

Commit

Permalink
Cleanup - use pointer-type and type-name in vectors wherever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
quietust committed Mar 26, 2014
1 parent a845f9c commit 17f04bf
Show file tree
Hide file tree
Showing 32 changed files with 538 additions and 1,519 deletions.
24 changes: 6 additions & 18 deletions df.advmode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,9 @@
<int32_t name='unk18'/>
<int32_t name='unk19'/>

<stl-vector name='unk20'>
<int32_t ref-target='world_site'/>
</stl-vector>
<stl-vector name='unk21'>
<int32_t/>
</stl-vector>
<stl-vector name='unk22'>
<int32_t/>
</stl-vector>
<stl-vector name='unk20' type-name='int32_t' ref-target='world_site'/>
<stl-vector name='unk21' type-name='int32_t'/>
<stl-vector name='unk22' type-name='int32_t'/>

<int16_t name='unk23'/>
<int16_t name='unk24'/>
Expand Down Expand Up @@ -169,9 +163,7 @@
<stl-vector name='unk28'/>
<stl-vector name='unk29'/>
<stl-vector name='unk30'/>
<stl-vector name='actions'>
<pointer type-name='adventure_movement_option'/>
</stl-vector>
<stl-vector name='actions' pointer-type='adventure_movement_option'/>
<stl-vector name='unk31' comment='v0.34.08'/>

<int32_t name='unk32'/>
Expand All @@ -184,15 +176,11 @@
<int32_t name='unk36'/>

<compound name='companions'>
<stl-vector name='unit'>
<pointer type-name='unit'/>
</stl-vector>
<stl-vector name='unit' pointer-type='unit'/>
<stl-bit-vector name='unit_visible'/>
<compound name='unit_position' type-name='coord_path'/>

<stl-vector name='all_histfigs' comment='includes dead'>
<int32_t ref-target='historical_figure'/>
</stl-vector>
<stl-vector name='all_histfigs' comment='includes dead' type-name='int32_t' ref-target='historical_figure'/>
</compound>

<stl-vector name='unk37'/>
Expand Down
8 changes: 2 additions & 6 deletions df.art.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,8 @@
<code-helper name='find-instance'>$(find-instance $art_image_chunk $$).images[$]</code-helper>
<code-helper name='describe'>(describe-obj $.name)</code-helper>

<stl-vector name='elements'>
<pointer type-name='art_image_element'/>
</stl-vector>
<stl-vector name='properties'>
<pointer type-name='art_image_property'/>
</stl-vector>
<stl-vector name='elements' pointer-type='art_image_element'/>
<stl-vector name='properties' pointer-type='art_image_property'/>

<int32_t name='event' ref-target='history_event'/>
<compound name='name' type-name='language_name'/>
Expand Down
4 changes: 1 addition & 3 deletions df.building-raws.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
<int32_t name='build_key'/>
<bool name='needs_magma'/>

<stl-vector name="build_items">
<pointer type-name='building_def_item'/>
</stl-vector>
<stl-vector name="build_items" pointer-type='building_def_item'/>

<int32_t name="dim_x"/>
<int32_t name="dim_y"/>
Expand Down
94 changes: 24 additions & 70 deletions df.buildings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,14 @@
<int16_t name='race' ref-target='creature_raw'/>
<int32_t name='id' init-value='-1'/>

<stl-vector name='jobs'>
<pointer type-name='job'/>
</stl-vector>
<stl-vector name='specific_refs'>
<pointer type-name='specific_ref'/>
</stl-vector>
<stl-vector name='general_refs'>
<pointer type-name='general_ref'/>
</stl-vector>
<stl-vector name='jobs' pointer-type='job'/>
<stl-vector name='specific_refs' pointer-type='specific_ref'/>
<stl-vector name='general_refs' pointer-type='general_ref'/>

<bool name='is_room'/>

<stl-vector name='children' comment='other buildings within this room'>
<pointer type-name='building'/>
</stl-vector>
<stl-vector name='parents' comment='rooms this building belongs to'>
<pointer type-name='building'/>
</stl-vector>
<stl-vector name='children' pointer-type='building' comment='other buildings within this room'/>
<stl-vector name='parents' pointer-type='building' comment='rooms this building belongs to'/>

<pointer type-name='unit' name='owner'/>

Expand Down Expand Up @@ -446,7 +436,7 @@

<vmethod name='getSquads'>
<ret-type>
<pointer><stl-vector><pointer type-name='building_squad_use'/></stl-vector></pointer>
<pointer><stl-vector pointer-type='building_squad_use'/></pointer>
</ret-type>
</vmethod>
<vmethod name='getSpecificSquad' ret-type='int32_t'/>
Expand All @@ -463,18 +453,10 @@
-- stockpile --

<struct-type type-name='stockpile_links'>
<stl-vector name='give_to_pile'>
<pointer type-name='building'/>
</stl-vector>
<stl-vector name='take_from_pile'>
<pointer type-name='building'/>
</stl-vector>
<stl-vector name='give_to_workshop'>
<pointer type-name='building'/>
</stl-vector>
<stl-vector name='take_from_workshop'>
<pointer type-name='building'/>
</stl-vector>
<stl-vector name='give_to_pile' pointer-type='building'/>
<stl-vector name='take_from_pile' pointer-type='building'/>
<stl-vector name='give_to_workshop' pointer-type='building'/>
<stl-vector name='take_from_workshop' pointer-type='building'/>
</struct-type>

<class-type type-name='building_stockpilest' inherits-from='building'>
Expand All @@ -487,9 +469,7 @@
<stl-vector name='container_type'>
<enum base-type='int16_t' type-name='item_type'/>
</stl-vector>
<stl-vector name='container_item_id'>
<int32_t ref-target='item'/>
</stl-vector>
<stl-vector name='container_item_id' type-name='int32_t' ref-target='item'/>
<stl-vector name='container_x' type-name='int16_t'/>
<stl-vector name='container_y' type-name='int16_t'/>

Expand All @@ -498,9 +478,7 @@
<int32_t name='use_links_only'/>
<int32_t name='stockpile_number' init-value='-1'/>

<stl-vector name='linked_stops'>
<pointer type-name='hauling_stop'/>
</stl-vector>
<stl-vector name='linked_stops' pointer-type='hauling_stop'/>
</class-type>

-- zone --
Expand Down Expand Up @@ -558,12 +536,8 @@
</enum-type>

<class-type type-name='building_civzonest' inherits-from='building'>
<stl-vector name='assigned_units'>
<int32_t ref-target='unit'/>
</stl-vector>
<stl-vector name='assigned_items'>
<int32_t ref-target='item'/>
</stl-vector>
<stl-vector name='assigned_units' type-name='int32_t' ref-target='unit'/>
<stl-vector name='assigned_items' type-name='int32_t' ref-target='item'/>
<enum base-type='int32_t' name="type" type-name='civzone_type' comment='only saved as int16'/>
<bitfield name='zone_flags' base-type='uint32_t'>
<flag-bit name='water_source'/>
Expand Down Expand Up @@ -692,9 +666,7 @@
</enum-type>

<struct-type type-name='workshop_profile'>
<stl-vector name="permitted_workers">
<int32_t ref-target='unit'/>
</stl-vector>
<stl-vector name="permitted_workers" type-name='int32_t' ref-target='unit'/>
<int32_t name="min_level"/>
<int32_t name="max_level" init-value='3000'/>
</struct-type>
Expand Down Expand Up @@ -729,9 +701,7 @@
<class-type type-name='building_armorstandst' inherits-from='building_actual'>
<int16_t name='unk_c0'/>

<stl-vector name='squads'>
<pointer type-name='building_squad_use'/>
</stl-vector>
<stl-vector name='squads' pointer-type='building_squad_use'/>
<int32_t name='specific_squad' ref-target='squad'/>
<int32_t name='specific_position' init-value='-1'/>
</class-type>
Expand All @@ -747,9 +717,7 @@
</class-type>

<struct-type type-name='building_users'>
<stl-vector name='unit'>
<int32_t ref-target='unit'/>
</stl-vector>
<stl-vector name='unit' type-name='int32_t' ref-target='unit'/>
<stl-vector name='mode' type-name='int16_t'/>
</struct-type>

Expand All @@ -758,19 +726,15 @@
<flag-bit name='barracks'/>
<flag-bit name='dormitory'/>
</bitfield>
<stl-vector name='squads'>
<pointer type-name='building_squad_use'/>
</stl-vector>
<stl-vector name='squads' pointer-type='building_squad_use'/>
<int32_t name='specific_squad' ref-target='squad'/>
<int32_t name='specific_position' init-value='-1'/>
<compound name='users' type-name='building_users'/>
</class-type>

<class-type type-name='building_boxst' inherits-from='building_actual'>
<int16_t/>
<stl-vector name='squads'>
<pointer type-name='building_squad_use'/>
</stl-vector>
<stl-vector name='squads' pointer-type='building_squad_use'/>
<int32_t name='specific_squad' ref-target='squad'/>
<int32_t name='specific_position' init-value='-1'/>
</class-type>
Expand All @@ -790,20 +754,14 @@

<class-type type-name='building_cabinetst' inherits-from='building_actual'>
<int16_t/>
<stl-vector name='squads'>
<pointer type-name='building_squad_use'/>
</stl-vector>
<stl-vector name='squads' pointer-type='building_squad_use'/>
<int32_t name='specific_squad' ref-target='squad'/>
<int32_t name='specific_position' init-value='-1'/>
</class-type>

<class-type type-name='building_cagest' inherits-from='building_actual'>
<stl-vector name='assigned_units'>
<int32_t ref-target='unit'/>
</stl-vector>
<stl-vector name='assigned_items'>
<int32_t ref-target='item'/>
</stl-vector>
<stl-vector name='assigned_units' type-name='int32_t' ref-target='unit'/>
<stl-vector name='assigned_items' type-name='int32_t' ref-target='item'/>
<bitfield base-type='uint16_t' name='cage_flags'>
<flag-bit name='triggered'/>
</bitfield>
Expand Down Expand Up @@ -1056,9 +1014,7 @@
<flag-bit name='disabling'/>
<flag-bit name='enabling'/>
</bitfield>
<stl-vector name='linked_mechanisms'>
<pointer type-name='item'/>
</stl-vector>
<stl-vector name='linked_mechanisms' pointer-type='item'/>
<stl-vector name='observed_by_civs' type-name='int32_t' ref-target='historical_entity'/>

<compound name='profile' type-name='workshop_profile'/>
Expand Down Expand Up @@ -1089,9 +1045,7 @@
<class-type type-name='building_weaponrackst' inherits-from='building_actual'>
<int16_t name='unk_c0'/>

<stl-vector name='squads'>
<pointer type-name='building_squad_use'/>
</stl-vector>
<stl-vector name='squads' pointer-type='building_squad_use'/>
<int32_t name='specific_squad' ref-target='squad'/>
</class-type>

Expand Down
Loading

0 comments on commit 17f04bf

Please sign in to comment.