Skip to content

Commit

Permalink
Merge branch 'master' into adv-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Jun 16, 2024
2 parents 8894a1c + 5718c3d commit 5ca5b5b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
8 changes: 7 additions & 1 deletion StructFields.pm
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,13 @@ sub emit_struct_fields($$;%) {
} 'fields-' . $fields_group;

# Needed for unions with fields with non-default ctors (e.g. bitfields)
emit "$name(){memset(this, 0, sizeof($name));}";
emit_block {
local $in_union = 1;
emit "memset(this, 0, sizeof(*this));";
# for unions with fields defined, initialize the first one
my $first_child = ($tag->findnodes('ld:field[1]'))[0];
render_field_init($first_child);
} "$name() ";

return;
}
Expand Down
24 changes: 9 additions & 15 deletions df.jobs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@
<bitfield name='encrust_flags' type-name='stockpile_group_set'/>
</struct-type>

<struct-type type-name='job_spec_data' is-union='true'>
<int32_t name="hist_figure_id" ref-target='historical_figure'/>
<int32_t name="race" ref-target='creature_raw'/>
<enum base-type='int32_t' name="improvement" type-name='improvement_type'/>
</struct-type>

<struct-type type-name='job' original-name='jobst' df-list-link-type='job_list_link' df-list-link-field='list_link' key-field='id'>
<int32_t name='id' init-value='-1'/>
<pointer name='list_link' type-name='job_list_link'/>
Expand All @@ -150,11 +156,7 @@
<int16_t name='item_subtype' init-value='-1' comment='when StoreInStockpile this is a unit_labor'/>

<compound name='specflag' type-name='job_spec_flags'/>
<compound name='specdata' is-union='true' init-value='-1'>
<int32_t name="hist_figure_id" ref-target='historical_figure'/>
<int32_t name="race" ref-target='creature_raw'/>
<enum base-type='int32_t' name="improvement" type-name='improvement_type'/>
</compound>
<compound name='specdata' type-name='job_spec_data'/>
<bitfield name='material_category' type-name='job_material_category' comment='bay12: uint32_t job_item_flag'/>

<stl-string name='reaction_name'/>
Expand Down Expand Up @@ -449,11 +451,7 @@
<int32_t name="mat_index" init-value='-1'/>

<compound name='specflag' type-name='job_spec_flags'/>
<compound name='specdata' is-union='true' init-value='-1'>
<int32_t name="hist_figure_id" ref-target='historical_figure'/>
<int32_t name="race" ref-target='creature_raw'/>
<enum base-type='int32_t' name="improvement" type-name='improvement_type'/>
</compound>
<compound name='specdata' type-name='job_spec_data'/>
<bitfield name="material_category" type-name='job_material_category'/>

<compound name='art_spec' type-name='job_art_specification'/>
Expand Down Expand Up @@ -524,11 +522,7 @@
<int16_t name="mat_type" ref-target='material' aux-value='$$.mat_index'/>
<int32_t name="mat_index"/>
<compound name='specflag' type-name='job_spec_flags'/>
<compound name='specdata' is-union='true' init-value='-1'>
<int32_t name="hist_figure_id" ref-target='historical_figure'/>
<int32_t name="race" ref-target='creature_raw'/>
<enum base-type='int32_t' name="improvement" type-name='improvement_type'/>
</compound>
<compound name='specdata' type-name='job_spec_data'/>
<bitfield name="material_category" type-name='job_material_category'/>
<int32_t name='match_value' init-value='1'/>

Expand Down
6 changes: 1 addition & 5 deletions df.ui-menus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,7 @@
<int16_t name='material' ref-target='material' aux-value='$$.matgloss'/>
<int32_t name='matgloss'/>
<compound name='specflag' type-name='job_spec_flags'/>
<compound name='specdata' is-union='true' init-value='-1'>
<int32_t name="hist_figure_id" ref-target='historical_figure'/>
<int32_t name="race" ref-target='creature_raw'/>
<enum base-type='int32_t' name="improvement" type-name='improvement_type'/>
</compound>
<compound name='specdata' type-name='job_spec_data'/>
<bitfield name='job_item_flag' type-name='job_material_category'/>
<bool name='add_building_location'/>
<bool name='show_help_instead'/>
Expand Down

0 comments on commit 5ca5b5b

Please sign in to comment.