Skip to content

Commit

Permalink
Great Reorganization: Fixes
Browse files Browse the repository at this point in the history
* fix bug in codegen with enums/bitfields with base-type "ulong"
* fix item_tool_graphics_flag so it compiles (Toady's definition is already wrong)
* fix site_architecture_change (two anonymous unions with conflicting names)
* fix size of d_init_announcementst
* add missing histfig_body_state.NONE (from whereabouts_type)
* fix instance-vectors for newly-created handlers
* remove trailing whitespace
  • Loading branch information
quietust committed Feb 8, 2025
1 parent 6c55a72 commit ff9c640
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 16 deletions.
3 changes: 2 additions & 1 deletion Common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ sub get_primitive_base($;$) {
if ($base =~ /u?int[136]?[2468]_t/) {
header_ref("cstdint");
}
$primitive_types{$base} or die "Must be primitive: $base\n";

$base = primitive_type_name($base);

return $base;
}
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Template for new versions:
# Future

## Structures
- reorganize all structure definitions to match bay12 header layouts
- promote all bay12 structures, enums, and bitfields to top-level types
- fill in a bunch of structures that were missing
- fix various structure errors

# 51.02-r1

Expand Down
2 changes: 1 addition & 1 deletion df.art_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
</struct-type>

<struct-type type-name='art_image_chunk' original-name='art_image_chunkst'
instance-vector='$global.world.art_image_chunks' key-field='id'>
instance-vector='$global.world.art_image_chunks.all' key-field='id'>
<int32_t name='id' comment='art_image_*.dat'/>

<static-array name='images' count='500' type-name='art_image_chunk_memberst'/>
Expand Down
2 changes: 1 addition & 1 deletion df.coinbatch.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<data-definition>
<struct-type type-name='coin_batch' original-name='coinbatchst' instance-vector='$global.world.coin_batches'>
<struct-type type-name='coin_batch' original-name='coinbatchst' instance-vector='$global.world.coin_batches.all'>
<int32_t name='year'/>
<int16_t name='mat_type' ref-target='material' aux-value='$$.mat_index'/>
<int32_t name='mat_index'/>
Expand Down
6 changes: 3 additions & 3 deletions df.creature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<enum-item name='SPLINTABLE'/>
</enum-type>

<struct-type type-name='tissue_template' instance-vector='$global.world.raws.tissue_templates' original-name='tissue_templatest'>
<struct-type type-name='tissue_template' instance-vector='$global.world.raws.tissue_templates.all' original-name='tissue_templatest'>
<stl-string name='id'/>
<df-flagarray name='flags' index-enum='tissue_flags'/>
<stl-string name='tissue_name_singular'/>
Expand Down Expand Up @@ -203,7 +203,7 @@
<stl-string name='comp_arg_str' since='v0.40.01'/>
</struct-type>

<struct-type type-name='creature_variation' instance-vector='$global.world.raws.creature_variations' original-name='creature_variationst'>
<struct-type type-name='creature_variation' instance-vector='$global.world.raws.creature_variations.all' original-name='creature_variationst'>
<stl-string name='id'/>
<stl-vector name='cv_convert_tag' pointer-type='creature_variation_convert_tag'/>
<stl-vector name='cv_new_tag' pointer-type='stl-string'/>
Expand All @@ -218,7 +218,7 @@
<stl-vector name='all' pointer-type='creature_variation'/>
</struct-type>

<struct-type type-name='body_detail_plan' instance-vector='$global.world.raws.body_detail_plans' original-name='body_detail_planst'>
<struct-type type-name='body_detail_plan' instance-vector='$global.world.raws.body_detail_plans.all' original-name='body_detail_planst'>
<stl-string name='id'/>

<stl-vector name='add_material_name' pointer-type='stl-string'/>
Expand Down
2 changes: 1 addition & 1 deletion df.creaturebody.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

-- Unused: CreatureBodyStrings

<struct-type type-name='body_template' instance-vector='$global.world.raws.body_templates' original-name='creaturebody_defst'>
<struct-type type-name='body_template' instance-vector='$global.world.raws.creaturebody.body_templates' original-name='creaturebody_defst'>
-- string[CreatureBodyStrings]
<stl-string name='id' comment='in bay12 this is a static array with one member'/>

Expand Down
2 changes: 1 addition & 1 deletion df.d_init.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@

<struct-type type-name='announcements' original-name='d_init_announcementst'>
<static-array name='flags' type-name='announcement_flags'
count='354' index-enum='announcement_type'/>
count='356' index-enum='announcement_type'/>
</struct-type>

<struct-type type-name='d_init'>
Expand Down
2 changes: 1 addition & 1 deletion df.d_interface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5749,7 +5749,7 @@
<int16_t name='amount'/>
</struct-type>

<struct-type type-name='lookinfo_spoorst'>
<struct-type type-name='lookinfo_spoorst'>
<bitfield name='flag' type-name='spoor_flag'/>
<enum name='type' type-name='spoor_type'/>
<int32_t name='id1'/>
Expand Down
2 changes: 1 addition & 1 deletion df.entity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@
<bitfield name='flags' base-type='uint32_t' type-name='entity_def_animal_flag'/>
</struct-type>

<struct-type type-name='entity_raw' original-name='entity_defst' instance-vector='$global.world.raws.entities'>
<struct-type type-name='entity_raw' original-name='entity_defst' instance-vector='$global.world.raws.entities.all'>
<stl-string name='code'/>
<int32_t name='index' since='v0.40.01' comment='into instace-vector'/>
<stl-vector name='raws' pointer-type='stl-string' since='v0.40.01'/>
Expand Down
1 change: 1 addition & 0 deletions df.history_figure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
</struct-type>

<enum-type type-name='histfig_body_state' base-type='int8_t'> bay12: HistFigBodyStateType
<enum-item name='NONE' value='-1'/>
<enum-item name='Active'/>
<enum-item name='BuriedAtSite'/>
<enum-item name='UnburiedAtBattlefield'/>
Expand Down
2 changes: 1 addition & 1 deletion df.interaction.xml
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
</enum-type>

<struct-type type-name='interaction'
instance-vector='$global.world.raws.interactions' key-field='id'
instance-vector='$global.world.raws.interactions.all' key-field='id'
original-name='interactionst'>
<stl-string name="name"/>
<int32_t name="id"/>
Expand Down
2 changes: 1 addition & 1 deletion df.itemdef.xml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
<flag-bit name='water'/>
<flag-bit name='dirt'/>
<flag-bit name='color_index' count='8'/>
<flag-bit name='localdef_shape_index' count='6'/> supposed to be 8, but the struct itself uses int32_t and only has room for 6
<flag-bit name='localdef_shape_index' count='5'/> supposed to be 8, but the struct itself uses int32_t and only has room for 5
</bitfield-type>

<enum-type type-name='item_tool_graphics_flag_material' base-type='int32_t'> bay12: ITEM_TOOL_GRAPHICS_FLAG_MATERIAL_*
Expand Down
2 changes: 1 addition & 1 deletion df.matgloss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<enum-item/>
</enum-type>

<struct-type type-name='inorganic_raw' original-name='inorganic_material_definitionst' instance-vector='$global.world.raws.inorganics' custom-methods='true'>
<struct-type type-name='inorganic_raw' original-name='inorganic_material_definitionst' instance-vector='$global.world.raws.inorganics.all' custom-methods='true'>
<stl-string name='id'/>

<stl-vector name='str' since='v0.34.01' pointer-type='stl-string'/>
Expand Down
2 changes: 1 addition & 1 deletion df.region.xml
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@
<int32_t name='y'/>
</struct-type>

<struct-type type-name='open_list_binary_heap_2Dst' since='v0.40.01'> bay12:
<struct-type type-name='open_list_binary_heap_2Dst' since='v0.40.01'>
<static-array name='node' count='80000' type-name='open_list_node_2Dst'/>
<int32_t name='size'/>
<int32_t name='x1'/>
Expand Down
2 changes: 1 addition & 1 deletion df.site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<int32_t name="year"/>
<int32_t name="year_tick" init-value='-1' comment='bay12: season_count'/>
<bitfield name="flags" base-type='uint32_t' type-name='site_architecture_flag'/>
<compound is-union='true' union-tag-field='type'>
<compound name='spec_flag' is-union='true' union-tag-field='type'>
<bitfield name="GENERALIZED_DAMAGE" base-type='uint32_t' type-name='site_architecture_flag_generalized_damage'/>
<bitfield name="GENERALIZED_DEATH" base-type='uint32_t' type-name='site_architecture_flag_generalized_death'/>
</compound>
Expand Down
2 changes: 1 addition & 1 deletion df.unit_chunk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</struct-type>

<struct-type type-name='unit_chunk' original-name='unit_chunkst'
instance-vector='$global.world.unit_chunks' key-field='id'>
instance-vector='$global.world.unit_chunks.all' key-field='id'>
<int32_t name='id' comment='unit_*.dat'/>
<static-array name='units' count='100' type-name='unit_chunk_memberst'/>
</struct-type>
Expand Down

0 comments on commit ff9c640

Please sign in to comment.