Skip to content

Commit

Permalink
Rename building_mats to material_type
Browse files Browse the repository at this point in the history
Add the 640 enum elements from Toady headers, and start using the enum
everywhere appropriate (with base-type overrides in spots where Toady
didn't use "Material").
  • Loading branch information
quietust committed Aug 31, 2024
1 parent 17527a0 commit 53c03f1
Show file tree
Hide file tree
Showing 30 changed files with 309 additions and 271 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Template for new versions:
# Future

## Structures
- renamed "builtin_mats" to "material_type" and expanded to match Bay12, updated all relevant fields to use it

# 50.13-r4

Expand Down
10 changes: 5 additions & 5 deletions df.advmode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,11 @@
<stl-vector name='valid_craft_guild_type' type-name='profession'/>
<int32_t name='selected_craft_guild'/>

<stl-vector name='material' type-name='int16_t'/>
<stl-vector name='material' type-name='material_type'/>
<stl-vector name='matgloss' type-name='int32_t'/>
<stl-vector name='mat_jobitemflag' type-name='uint32_t'/>
<stl-vector name='material_count' type-name='int32_t'/>
<stl-vector name='material_master' type-name='int16_t'/>
<stl-vector name='material_master' type-name='material_type'/>
<stl-vector name='matgloss_master' type-name='int32_t'/>
<stl-vector name='mat_jobitemflag_master' type-name='uint32_t'/>
<stl-vector name='material_count_master' type-name='int32_t'/>
Expand All @@ -601,7 +601,7 @@
<stl-vector name='start_menu_used_mat_item' type-name='int32_t'/>
<stl-vector name='start_menu_used_mat_item_st' type-name='int32_t'/>
<stl-vector name='start_menu_used_mat_item_tool_use' type-name='int32_t'/>
<stl-vector name='start_menu_used_material' type-name='int16_t'/>
<stl-vector name='start_menu_used_material' type-name='material_type'/>
<stl-vector name='start_menu_used_matgloss' type-name='int32_t'/>
<stl-vector name='start_menu_used_mat_job_item_flag' type-name='uint32_t'/>
<stl-vector name='start_menu_used_mat_state' type-name='matter_state'/>
Expand Down Expand Up @@ -1020,7 +1020,7 @@
</class-type>

<class-type type-name='adventure_environment_ingest_materialst' inherits-from='adventure_environment_optionst'>
<int16_t name='mat_type'/>
<enum name='mat_type' type-name='material_type'/>
<int32_t name='mat_index'/>
<enum name='mat_state' type-name='matter_state'/>
</class-type>
Expand Down Expand Up @@ -1128,7 +1128,7 @@
<pointer name='container' type-name='item'/>
<compound name='pos1' type-name='coord'/>
<compound name='pos2' type-name='coord'/>
<int16_t name='material'/>
<enum name='material' type-name='material_type'/>
<int32_t name='matgloss'/>
<enum name='state' type-name='matter_state'/>
</class-type>
Expand Down
8 changes: 4 additions & 4 deletions df.art.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<class-type type-name='art_image_element_itemst' inherits-from='art_image_element'>
<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 $)'/>
<int16_t name='mat_type' ref-target='material' aux-value='$$.mat_index'/>
<enum base-type='int16_t' name='mat_type' type-name='material_type'/>
<int16_t name='mat_index'/>
<bitfield name='flags' type-name='item_flags'/>
<int32_t name='item_id' ref-target='item' comment='for artifacts'/>
Expand Down Expand Up @@ -184,7 +184,7 @@
<int32_t name='event' ref-target='history_event'/>
<compound name='name' type-name='language_name'/>
<enum base-type='int32_t' name='spec_ref_type' type-name='specific_ref_type'/>
<int16_t name='mat_type' ref-target='material' aux-value='$$.mat_index'/>
<enum name='mat_type' type-name='material_type'/>
<int32_t name='mat_index'/>
<enum base-type='int16_t' name='quality' type-name='item_quality'/>
<int32_t name='artist' ref-target='historical_figure'/>
Expand Down Expand Up @@ -1142,10 +1142,10 @@

<struct-type type-name='service_orderst'>
<int32_t name='local_id'/>
<enum base-type='int32_t' name="type" type-name='service_order_type'/>
<enum name="type" type-name='service_order_type'/>
<enum name='item_type' type-name='item_type'/>
<int16_t name='item_subtype'/>
<int16_t name='mat_type'/>
<enum name='mat_type' type-name='material_type'/>
<int32_t name='mat_index'/>
<int32_t name='customer_hfid'/>
<int32_t name='customer_unid'/>
Expand Down
4 changes: 2 additions & 2 deletions df.building-raws.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
<struct-type type-name='building_def_item' original-name='building_def_build_itemst'>
<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 $)'/>
<int16_t name='mat_type' ref-target='material' aux-value='$$.mat_index'/>
<int16_t name='mat_index' init-value='-1' comment='actually int16, not int32 as used in other places'/>
<enum base-type='int16_t' name='mat_type' type-name='material_type'/>
<int16_t name='mat_index' init-value='-1' comment='not a 32-bit matgloss'/>

<stl-string name='reaction_class'/>
<stl-string name='has_material_reaction_product'/>
Expand Down
2 changes: 1 addition & 1 deletion df.buildings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@

<bitfield name='flags' type-name='building_flags'/>

<int16_t name='mat_type' ref-target='material' aux-value='$$.mat_index'/>
<enum name='mat_type' type-name='material_type'/>
<int32_t name='mat_index' init-value='-1'/>

<compound name='room' type-name='building_extents' comment='not a compound in bay12'/>
Expand Down
57 changes: 27 additions & 30 deletions df.creature-raws.xml
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@
<flag-bit name='bad_multiattack'/>
</bitfield>
<stl-vector type-name='specialattack_type' name='specialattack_type'/>
<stl-vector type-name='int16_t' name='specialattack_mat_type' comment='extract injected'/>
<stl-vector type-name='material_type' name='specialattack_mat_type' comment='extract injected'/>
<stl-vector type-name='int32_t' name='specialattack_mat_index'/>
<stl-vector type-name='matter_state' name='specialattack_mat_state'/>
<static-array count='3' name='specialattack_temp_mat' comment='parsed during second pass'><stl-vector pointer-type='stl-string'/></static-array>
Expand Down Expand Up @@ -774,7 +774,7 @@
<stl-string name='mat_str3'/>
<enum name='item_type' type-name='item_type'/>
<int16_t name='item_subtype'/>
<int16_t name='mat_type'/>
<enum name='mat_type' type-name='material_type'/>
<int32_t name='mat_index'/>
<bitfield base-type='uint32_t'> bay12: EBO_FLAG_*
<flag-bit name='material_any_hard_stone'/>
Expand Down Expand Up @@ -909,11 +909,10 @@
<int16_t name='vermin_bite_chance'/>
<int16_t name='grasstrample'/>
<int16_t name='buildingdestroyer'/>
<enum base-type='int16_t' name='itemcorpse_itemtype' type-name='item_type' comment="no longer used? Changes when the same save is reloaded"/>
<enum base-type='int16_t' name='itemcorpse_itemtype' type-name='item_type'/>
<int16_t name='itemcorpse_itemsubtype'/>
<int16_t name='itemcorpse_materialtype'
ref-target='material' aux-value='$$.itemcorpse_materialindex' comment="no longer used? Changes when the same save is reloaded"/>
<int16_t name='itemcorpse_materialindex'/> // NOT 32-bit!
<enum base-type='int16_t' name='itemcorpse_materialtype' type-name='material_type'/>
<int16_t name='itemcorpse_materialindex' comment='not a 32-bit matgloss'/>
<int16_t name='itemcorpse_quality'/>
<static-array type-name='int16_t' name='remains_color' count='3'/>
<int16_t name='difficulty'/>
Expand All @@ -937,10 +936,10 @@
<int32_t name='army_strength'/>
<int32_t name='pop_ratio'/>
<int32_t name='adult_size'/>
<int32_t name='bone_mat' ref-target='material' aux-value='$$.bone_matidx'/>
<enum base-type='int32_t' name='bone_mat' type-name='material_type'/>
<int32_t name='bone_matidx'/>
<int32_t name='fish_mat_index' refers-to='(food-mat-by-idx $Fish $)'/>
<int32_t name='egg_mat_index' refers-to='(food-mat-by-idx $Eggs $)'/>
<int32_t name='fish_mat_index' refers-to='(food-mat-by-idx $Fish $)' comment='actually a stockpile index, not a matgloss'/>
<int32_t name='egg_mat_index' refers-to='(food-mat-by-idx $Eggs $)' comment='actually a stockpile index, not a matgloss'/>
<static-array type-name='int32_t' name='attack_trigger' count='3'/>
<int32_t name='egg_size'/>
<int32_t name='grazer'/>
Expand Down Expand Up @@ -1056,70 +1055,68 @@
</compound>

<compound name='extracts'>
<stl-vector type-name='int16_t' name='extract_mat'/>
<stl-vector type-name='material_type' name='extract_mat'/>
<stl-vector type-name='int32_t' name='extract_matidx'/>
<static-array name='extract_str' count='3'>
<stl-vector pointer-type='stl-string'/>
</static-array>

<int16_t name='milkable_mat'/>
<enum name='milkable_mat' type-name='material_type'/>
<int32_t name='milkable_matidx'/>
<static-array name='milkable_str' count='3'>
<stl-string/>
</static-array>

<int16_t name='webber_mat'/>
<enum name='webber_mat' type-name='material_type'/>
<int32_t name='webber_matidx'/>
<static-array name='webber_str' count='3'>
<stl-string/>
</static-array>

<int16_t name='vermin_bite_mat'/>
<enum name='vermin_bite_mat' type-name='material_type'/>
<int32_t name='vermin_bite_matidx'/>
<int16_t name='vermin_bite_chance'/>
<enum name='vermin_bite_state' type-name='matter_state'/>
<static-array name='vermin_bite_str' count='3'>
<stl-string/>
</static-array>

<int16_t name='tendons_mat'/>
<enum name='tendons_mat' type-name='material_type'/>
<int32_t name='tendons_matidx'/>
<static-array name='tendons_str' count='3'>
<stl-string/>
</static-array>
<int32_t name='tendons_heal'/>

<int16_t name='ligaments_mat'/>
<enum name='ligaments_mat' type-name='material_type'/>
<int32_t name='ligaments_matidx'/>
<static-array name='ligaments_str' count='3'>
<stl-string/>
</static-array>
<int32_t name='ligaments_heal'/>

<int16_t name='blood_state'/>
<int16_t name='blood_mat'/>
<enum name='blood_state' type-name='matter_state'/>
<enum name='blood_mat' type-name='material_type'/>
<int32_t name='blood_matidx'/>
<static-array name='blood_str' count='3'>
<stl-string/>
</static-array>

<int16_t name='pus_state'/>
<int16_t name='pus_mat'/>
<enum name='pus_state' type-name='matter_state'/>
<enum name='pus_mat' type-name='material_type'/>
<int32_t name='pus_matidx'/>
<static-array name='pus_str' count='3'>
<stl-string/>
</static-array>

<stl-vector type-name='int16_t' name='egg_material_mattype'/>
<stl-vector type-name='material_type' name='egg_material_mattype'/>
<stl-vector type-name='int32_t' name='egg_material_matindex'/>
<static-array name='egg_material_str' count='3'>
<stl-vector pointer-type='stl-string'/>
</static-array>

<stl-vector name='lays_unusual_eggs_itemtype'>
<enum base-type='int16_t' type-name='item_type'/>
</stl-vector>
<stl-vector name='lays_unusual_eggs_itemtype' type-name='item_type'/>
<stl-vector name='lays_unusual_eggs_itemsubtype' type-name='int16_t'/>
<stl-vector type-name='int16_t' name='lays_unusual_eggs_mattype'/>
<stl-vector type-name='material_type' name='lays_unusual_eggs_mattype'/>
<stl-vector type-name='int32_t' name='lays_unusual_eggs_matindex'/>
<static-array name='lays_unusual_eggs_str' count='5'>
<stl-vector pointer-type='stl-string'/>
Expand All @@ -1128,7 +1125,7 @@

<stl-vector name='secretion'>
<pointer> bay12: secretion_profilest
<int16_t name='mat_type' ref-target='material' aux-value='$$.mat_index'/>
<enum name='mat_type' type-name='material_type'/>
<int32_t name='mat_index'/>
<enum type-name='matter_state' base-type='int16_t' name='mat_state'/>
<stl-string name="mat_str1"/>
Expand Down Expand Up @@ -1180,7 +1177,7 @@
<stl-vector name='worldgen_material_defining_flag' type-name='int32_t' since='v0.34.01'/>

muscle:
<int16_t name='meat_mat_type' ref-target='material' aux-value='$$.mat_index'/>
<enum name='meat_mat_type' type-name='material_type'/>
<int32_t name='meat_mat_index'/>

<static-array type-name='int32_t' name='habit_num' count='2'/>
Expand Down Expand Up @@ -1211,7 +1208,7 @@
<stl-string name='mat_1'/>
<stl-string name='mat_2'/>
<stl-string name='mat_3'/>
<int16_t name='mat_type'/>
<enum name='mat_type' type-name='material_type'/>
<int32_t name='mat_indx'/>
<int32_t name='multiplier'/>
<int32_t name='divisor'/>
Expand Down Expand Up @@ -1680,7 +1677,7 @@
<stl-string name='tissue_name_singular'/>
<stl-string name='tissue_name_plural'/>
<static-array name='tissue_material_str' type-name='stl-string' count='3'/>
<int16_t name='mat_type' ref-target='material' aux-value='$$.mat_index'/>
<enum name='mat_type' type-name='material_type'/>
<int32_t name='mat_index'/>
<int32_t name='relative_thickness'/>
<int32_t name='healing_rate'/>
Expand All @@ -1700,7 +1697,7 @@
<stl-string name='tissue_name_singular'/>
<stl-string name='tissue_name_plural'/>
<static-array name='tissue_material_str' type-name='stl-string' count='3'/>
<int16_t name='mat_type' ref-target='material' aux-value='$$.mat_index'/>
<enum name='mat_type' type-name='material_type'/>
<int32_t name='mat_index'/>
<int32_t name='relative_thickness'/>
<int32_t name='healing_rate'/>
Expand Down
18 changes: 8 additions & 10 deletions df.entities.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@
<int16_t refers-to='(item-subtype-target $$._global.item_type[$$._key] $)'/>
</stl-vector>
<stl-vector name='mat_types'>
<int16_t ref-target='material' aux-value='$$._parent.mat_indices[$._key]'/>
<enum base-type='int16_t' type-name='material_type'/>
</stl-vector>
<stl-vector name='mat_indices' type-name='int16_t'/>
<stl-vector name='mat_indices' type-name='int16_t' comment='not a 32-bit matgloss'/>
<stl-vector name="mat_cats" type-name='job_material_category'/>
<stl-vector type-name='int8_t' name='priority'/>
</struct-type>
Expand Down Expand Up @@ -334,9 +334,9 @@
<int16_t name='item_subtype' refers-to='(item-subtype-target $$._parent._parent.item_types[$$._key] $)'/>
</stl-vector>
<stl-vector name='mat_types'>
<int16_t ref-target='material' aux-value='$$._parent.mat_indices[$._key]'/>
<enum base-type='int16_t' type-name='material_type'/>
</stl-vector>
<stl-vector name='mat_indices' type-name='int16_t'/> yes, actually int16 even though matgloss should be int32
<stl-vector name='mat_indices' type-name='int16_t' comment='not a 32-bit matgloss'/>
</struct-type>

<enum-type type-name='historical_entity_type' base-type='int16_t'> bay12: EntityType
Expand Down Expand Up @@ -621,9 +621,7 @@
<compound name='seeds' type-name='material_vec_ref'/>

<compound name='wood_products' comment='lye, charcoal, potash, pearlash, and coke'>
<stl-vector name='item_type'>
<enum base-type='int16_t' type-name='item_type'/>
</stl-vector>
<stl-vector name='item_type' type-name='item_type'/>
<stl-vector type-name='int16_t' name='item_subtype'/>
<compound name='material' type-name='material_vec_ref'/>
</compound>
Expand All @@ -643,14 +641,14 @@
<stl-vector name='wagon_puller_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.wagon_puller_races[$._key]'/>
<stl-vector name='mount_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.mount_races[$._key]'/>
<stl-vector name='minion_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.minion_races[$._key]'/>
<stl-vector name='exotic_pet_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.unk728_races[$._key]'/>
<stl-vector name='exotic_pet_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.exotic_pet_races[$._key]'/>
</compound>

<stl-vector name='meat_fish_recipes' pointer-type='entity_recipe'/>
<stl-vector name='other_recipes' pointer-type='entity_recipe'/>

<static-array name='soldier_mats' count='3' comment='melee, archer1, archer - unused?'>
<int16_t name='mat_type' init-value='-1'/>
<enum name='mat_type' type-name='material_type'/>
<int32_t name='mat_index'/>
</static-array>

Expand Down Expand Up @@ -1168,7 +1166,7 @@
<enum name='image_material_class' type-name='entity_material_category'/>
<int16_t name='maker_race'/>
<bitfield name="indiv_choice" type-name='uniform_indiv_choice'/>
<int16_t name="mattype" ref-target='material' aux-value='$$.matindex'/>
<enum name='mattype' type-name='material_type'/>
<int32_t name="matindex"/>
<enum name="material_class" type-name='entity_material_category'/>
</struct-type>
Expand Down
4 changes: 2 additions & 2 deletions df.globals.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@
</global-object>
<global-object name='created_item_mattype' original-name='itemmade_subcat1'>
<stl-vector>
<int16_t ref-target='material' aux-value='$global.created_item_matindex[$._key]'/>
<enum base-type='int16_t' type-name='material_type'/>
</stl-vector>
</global-object>
<global-object name='created_item_matindex' original-name='itemmade_subcat2'>
<stl-vector type-name='int16_t'/>
<stl-vector type-name='int16_t' comment='not a 32-bit matgloss'/>
</global-object>
<global-object name='created_item_count' original-name='itemmade_number'>
<stl-vector type-name='int32_t'/>
Expand Down
Loading

0 comments on commit 53c03f1

Please sign in to comment.