Skip to content

Commit f644b6f

Browse files
authored
Merge pull request #778 from quietust/master
Sync ref/unit structures to Toady headers
2 parents 448cfae + 18ee4d0 commit f644b6f

File tree

5 files changed

+707
-533
lines changed

5 files changed

+707
-533
lines changed

df.history.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
<struct-type type-name='history_hit_item'> not a real structure, contents declared inline in all known locations
2121
<int32_t name='item' ref-target='item'/>
22-
<enum base-type='int16_t' name='item_type' type-name='item_type'/>
22+
<enum name='item_type' type-name='item_type'/>
2323
<int16_t name='item_subtype' refers-to='(item-subtype-target $$._parent.item_type $)'/>
2424

2525
<int16_t name='mattype' ref-target='material' aux-value='$$.matindex'/>
2626
<int32_t name='matindex'/>
2727

2828
-- If shot by a ranged weapon:
2929
<int32_t name='shooter_item' ref-target='item'/>
30-
<enum base-type='int16_t' name='shooter_item_type' type-name='item_type'/>
30+
<enum name='shooter_item_type' type-name='item_type'/>
3131
<int16_t name='shooter_item_subtype' refers-to='(item-subtype-target $$._parent.shooter_item_type $)'/>
3232
<int16_t name='shooter_mattype' ref-target='material' aux-value='$$.shooter_matindex'/>
3333
<int32_t name='shooter_matindex'/>

df.items.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,24 @@
102102
<compound name='base' type-name='spatter_common'/> sub-element, NOT subclass!
103103
<int16_t name='body_part_id'
104104
refers-to='$$._global._parent._global.body.body_plan.body_parts[$]'/>
105-
<bitfield base-type='uint16_t' name='flags'> bay12: ITEM_CONTAMINANT_FLAG_
105+
<bitfield base-type='uint16_t' name='flags'> bay12: ITEM_CONTAMINANT_FLAG_*
106106
<flag-bit name='water_soluble' comment='bay12: EXTERNAL'/>
107107
</bitfield>
108108
</struct-type>
109109

110+
<struct-type type-name='unit_spatter' original-name='unit_contaminantst'>
111+
<compound name='base' type-name='spatter_common'/> sub-element, NOT subclass!
112+
<int16_t name='body_part_id'
113+
refers-to='$$._global._parent._global.body.body_plan.body_parts[$]'/>
114+
<bitfield base-type='uint16_t' name='flags'> bay12: UNIT_CONTAMINANT_FLAG_*
115+
<flag-bit name='external'/>
116+
</bitfield>
117+
</struct-type>
118+
119+
<struct-type type-name='plant_spatter' original-name='veg_contaminantst'>
120+
<compound name='base' type-name='spatter_common'/> sub-element, NOT subclass!
121+
</struct-type>
122+
110123
<enum-type type-name='item_quality' base-type='int16_t'> DFHack-only
111124
<enum-item name='Ordinary'/>
112125
<enum-item name='WellCrafted'/>

df.plants.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
<int32_t name='site_id' ref-target='world_site'/>
3939
<int32_t name='srb_id' ref-target='site_realization_building' aux-value='$$.site_id'/>
40-
<stl-vector name='contaminants' pointer-type='spatter_common'/> bay12: actually veg_contaminantst
40+
<stl-vector name='contaminants' pointer-type='plant_spatter'/>
4141
<pointer name='tree_info' type-name='plant_tree_info' comment='Sapling if NULL'/>
4242
</struct-type>
4343

df.refs.xml

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<data-definition>
2-
<enum-type type-name='general_ref_type'>
2+
<enum-type type-name='general_ref_type'> bay12: GeneralRef, no base type
33
<enum-item name='NONE' value='-1'/>
44
<enum-item name="ARTIFACT"/>
55
<enum-item name="IS_ARTIFACT"/>
@@ -135,6 +135,7 @@
135135
</vmethod>
136136
<vmethod name='getDescription' comment='bay12: descriptive_string'>
137137
<pointer name='str' type-name='stl-string'/>
138+
<uint32_t name='context_flag'/>
138139
</vmethod>
139140
<vmethod name='getDescription2' comment='bay12: short_name'>
140141
<pointer name='str' type-name='stl-string'/>
@@ -177,7 +178,7 @@
177178

178179
<class-type type-name='general_ref_mapsquare' inherits-from='general_ref'
179180
original-name='general_ref_mapsquarest'>
180-
<enum base-type='int16_t' name='tiletype' type-name='tiletype'/>
181+
<enum base-type='uint16_t' name='tiletype' type-name='tiletype'/>
181182
<int16_t name="mat_type" ref-target='material' aux-value='$$.mat_index'/>
182183
<int32_t name="mat_index" init-value='-1'/>
183184
</class-type>
@@ -217,9 +218,9 @@
217218

218219
<class-type type-name='general_ref_interactionst' inherits-from='general_ref'>
219220
<int32_t name='interaction_id' ref-target='interaction'/>
220-
<int32_t name='source_id' ref-target='interaction_source' aux-value='$$.interaction_id'/>
221-
<int32_t name='unk_08'/>
222-
<int32_t name='unk_0c'/>
221+
<int32_t name='source_idx' ref-target='interaction_source' aux-value='$$.interaction_id'/>
222+
<int32_t name='target_idx' ref-target='interaction_target'/>
223+
<int32_t name='effect_idx' ref-target='interaction_effect'/>
223224
</class-type>
224225

225226
<class-type type-name='general_ref_abstract_buildingst' inherits-from='general_ref'>
@@ -232,7 +233,7 @@
232233
</class-type>
233234

234235
<class-type type-name='general_ref_spherest' inherits-from='general_ref'>
235-
<enum base-type='int16_t' name='sphere_type' type-name='sphere_type'/>
236+
<enum name='sphere_type' type-name='sphere_type'/>
236237
</class-type>
237238

238239
<class-type type-name='general_ref_sitest' inherits-from='general_ref'>
@@ -252,18 +253,18 @@
252253
</class-type>
253254

254255
<class-type type-name='general_ref_entity_popst' inherits-from='general_ref'>
255-
<int32_t name='unk_1'/>
256+
<int32_t name='pop_id' ref-target='entity_population'/>
256257
<int32_t name='race' ref-target='creature_raw'/>
257-
<int32_t name='unk_2'/>
258-
<bitfield name='flags' type-name='undead_flags'/>
258+
<int32_t name='num'/>
259+
<bitfield name='flags' type-name='undead_flags'/> bay12: GEN_REF_EPOP_FLAG_*
259260
</class-type>
260261

261262
<class-type type-name='general_ref_creaturest' inherits-from='general_ref'>
262263
<int32_t name='race' ref-target='creature_raw'/>
263264
<int32_t name='caste' ref-target='caste_raw' aux-value='$$.race'/>
264-
<int32_t name='unk_1'/>
265-
<int32_t name='unk_2'/>
266-
<bitfield name='flags' type-name='undead_flags'/>
265+
<int32_t name='pop_id' ref-target='entity_population'/>
266+
<int32_t name='num'/>
267+
<bitfield name='flags' type-name='undead_flags'/> bay12: GEN_REF_CREATURE_FLAG_*
267268
</class-type>
268269

269270
<class-type type-name='general_ref_knowledge_scholar_flagst' inherits-from='general_ref'>
@@ -276,12 +277,12 @@
276277
</class-type>
277278

278279
<class-type type-name='general_ref_value_levelst' inherits-from='general_ref'>
279-
<enum name='value' base-type='int32_t' type-name='value_type'/>
280+
<enum name='value' type-name='value_type'/>
280281
<int32_t name='level' comment='see http://dwarffortresswiki.org/index.php/DF2014:Personality_trait'/>
281282
</class-type>
282283

283284
<class-type type-name='general_ref_languagest' inherits-from='general_ref'>
284-
<int32_t name='unk_1'/>
285+
<int32_t name='language_idx'/>
285286
</class-type>
286287

287288
<class-type type-name='general_ref_written_contentst' inherits-from='general_ref'>
@@ -308,9 +309,9 @@
308309
<class-type type-name='general_ref_unit_milkeest' inherits-from='general_ref_unit'/>
309310
<class-type type-name='general_ref_unit_traineest' inherits-from='general_ref_unit'/>
310311
<class-type type-name='general_ref_unit_itemownerst' inherits-from='general_ref_unit'>
311-
<bitfield name='flags' since='v0.34.06'>
312+
<bitfield name='flags' since='v0.34.06' base-type='uint32_t'> bay12: GENERAL_REF_UNIT_ITEMOWNER_FLAG_*
312313
<flag-bit name='litter'
313-
comment='apparetly set after 1000 ticks, then confiscated in 1000 more ticks'/>
314+
comment='PROBATION; set after 1000 ticks, then confiscated in 1000 more ticks'/>
314315
</bitfield>
315316
</class-type>
316317
<class-type type-name='general_ref_unit_tradebringerst' inherits-from='general_ref_unit'/>
@@ -339,7 +340,7 @@
339340
<class-type type-name='general_ref_building_holderst' inherits-from='general_ref_building'/>
340341
<class-type type-name='general_ref_building_well_tag' inherits-from='general_ref_building'
341342
original-name='general_ref_building_well_tagst'>
342-
<int8_t name='direction'/>
343+
<uint8_t name='direction'/>
343344
</class-type>
344345
<class-type type-name='general_ref_building_use_target_1st' inherits-from='general_ref_building'/>
345346
<class-type type-name='general_ref_building_use_target_2st' inherits-from='general_ref_building'/>
@@ -350,7 +351,7 @@
350351
<class-type type-name='general_ref_entity_offeredst' inherits-from='general_ref_entity'/>
351352
<class-type type-name='general_ref_entity_itemownerst' inherits-from='general_ref_entity'/>
352353

353-
<enum-type type-name='specific_ref_type'> Bay12: ReferenceType
354+
<enum-type type-name='specific_ref_type' base-type='int16_t'> bay12: ReferenceType
354355
<enum-attr name='union_field'/>
355356

356357
<enum-item name='NONE' value='-1'/>
@@ -425,13 +426,13 @@
425426
<pointer name='histfig' type-name='historical_figure'/>
426427
<pointer name='entity' type-name='historical_entity'/>
427428
<compound name='wrestle'>
428-
<pointer name='unk_1'/>
429+
<pointer name='unit' type-name='unit'/>
429430
<pointer name='item' type-name='unit_item_wrestle'/>
430431
</compound>
431432
</compound>
432433
</struct-type>
433434

434-
<enum-type type-name='histfig_entity_link_type'>
435+
<enum-type type-name='histfig_entity_link_type' base-type='int16_t'> bay12: HistFigEntityLinkType
435436
<enum-item name='MEMBER'/>
436437
<enum-item name='FORMER_MEMBER'/>
437438
<enum-item name='MERCENARY'/>
@@ -465,8 +466,8 @@
465466
<pointer name='file' type-name='file_compressorst'/>
466467
<enum name='loadversion' type-name='save_version'/>
467468
</vmethod>
468-
<vmethod/>
469-
<vmethod/>
469+
<vmethod ret-type='int32_t' name='getSquadId'/>
470+
<vmethod ret-type='int32_t' name='getSquadPosition'/>
470471
<vmethod ret-type='int32_t' name='getPosition'/>
471472
<vmethod ret-type='int32_t' name='getOccupation'/>
472473
<vmethod ret-type='int32_t' name='getPositionStartYear'/>
@@ -506,26 +507,26 @@
506507
<int32_t name='start_year'/>
507508
</class-type>
508509
<class-type type-name='histfig_entity_link_squadst' inherits-from='histfig_entity_link'>
509-
<int32_t name='squad_id'/>
510+
<int32_t name='squad_id' ref-target='squad'/>
510511
<int32_t name='squad_position'/>
511512
<int32_t name='start_year'/>
512513
</class-type>
513514
<class-type type-name='histfig_entity_link_former_squadst' inherits-from='histfig_entity_link'>
514-
<int32_t name='squad_id'/>
515+
<int32_t name='squad_id' ref-target='squad'/>
515516
<int32_t name='start_year'/>
516517
<int32_t name='end_year'/>
517518
</class-type>
518519
<class-type type-name='histfig_entity_link_occupationst' inherits-from='histfig_entity_link'>
519-
<int32_t name='occupation_id'/>
520+
<int32_t name='occupation_id' ref-target='occupation'/>
520521
<int32_t name='start_year'/>
521522
</class-type>
522523
<class-type type-name='histfig_entity_link_former_occupationst' inherits-from='histfig_entity_link'>
523-
<int32_t name='occupation_id'/>
524+
<int32_t name='occupation_id' ref-target='occupation'/>
524525
<int32_t name='start_year'/>
525526
<int32_t name='end_year'/>
526527
</class-type>
527528

528-
<enum-type type-name='histfig_site_link_type'>
529+
<enum-type type-name='histfig_site_link_type' base-type='int16_t'> bay12: HistFigSiteLinkType
529530
<enum-item name='OCCUPATION'/>
530531
<enum-item name='SEAT_OF_POWER'/>
531532
<enum-item name='HANGOUT'/>
@@ -558,7 +559,7 @@
558559
</class-type>
559560

560561
<class-type type-name='histfig_site_link_occupationst' inherits-from='histfig_site_link'>
561-
<int32_t name='unk_1'/>
562+
<int32_t name='occupation_id' ref-target='occupation'/>
562563
</class-type>
563564
<class-type type-name='histfig_site_link_seat_of_powerst' inherits-from='histfig_site_link'/>
564565
<class-type type-name='histfig_site_link_hangoutst' inherits-from='histfig_site_link'/>
@@ -571,7 +572,7 @@
571572
<class-type type-name='histfig_site_link_prison_site_building_profilest' inherits-from='histfig_site_link'/>
572573

573574

574-
<enum-type type-name='histfig_hf_link_type'>
575+
<enum-type type-name='histfig_hf_link_type' base-type='int16_t'> bay12: HistFigHfLinkType
575576
<enum-item name='MOTHER'/>
576577
<enum-item name='FATHER'/>
577578
<enum-item name='SPOUSE'/>
@@ -593,6 +594,7 @@
593594
<class-type type-name='histfig_hf_link' original-name='histfig_hf_linkst'>
594595
<int32_t name='target_hf' ref-target='historical_figure'/>
595596
<int16_t name='link_strength'/>
597+
<int32_t name='hf_vector_idx' init-value='-1' refers-to='$global.world.history.figures[$]'/>
596598

597599
<virtual-methods>
598600
<vmethod ret-type='histfig_hf_link_type' name='getType'/>
@@ -620,30 +622,28 @@
620622
<class-type type-name='histfig_hf_link_masterst' inherits-from='histfig_hf_link'/>
621623
<class-type type-name='histfig_hf_link_apprenticest' inherits-from='histfig_hf_link'/>
622624
<class-type type-name='histfig_hf_link_companionst' inherits-from='histfig_hf_link'>
623-
<int32_t name='unk_1'/>
624-
<int32_t name='unk_2'/>
625+
<int32_t name='agreement_id'/>
626+
<int32_t name='agreement_party_id'/>
625627
</class-type>
626628
<class-type type-name='histfig_hf_link_former_apprenticest' inherits-from='histfig_hf_link'/>
627629
<class-type type-name='histfig_hf_link_former_masterst' inherits-from='histfig_hf_link'/>
628630
<class-type type-name='histfig_hf_link_pet_ownerst' inherits-from='histfig_hf_link'/>
629631
<class-type type-name='histfig_hf_link_former_spousest' inherits-from='histfig_hf_link'/>
630632
<class-type type-name='histfig_hf_link_deceased_spousest' inherits-from='histfig_hf_link'/>
631633

632-
<enum-type type-name='entity_entity_link_type' base-type='int16_t'>
634+
<enum-type type-name='entity_entity_link_type'> bay12: EntityAssociation, no base type
633635
<enum-item name='PARENT'/>
634636
<enum-item name='CHILD'/>
635637
<enum-item name='RELIGIOUS' comment='Seen between religion and merc company.' since='v0.47.01'/>
636638
</enum-type>
637639

638-
<struct-type type-name='entity_entity_link'>
640+
<struct-type type-name='entity_entity_link' original-name='entity_associationst'>
639641
<enum base-type='int16_t' type-name='entity_entity_link_type' name='type'/>
640642
<int32_t name='target' ref-target='historical_entity'/>
641643
<int16_t name='strength'/>
642644
</struct-type>
643645

644-
<enum-type type-name='entity_site_link_type' base-type='int32_t' comment="Enum names updated per Putnam">
645-
Mostly guesswork, hence the 'research notes' below. Interacts highly with status
646-
Putnam has provided us with some source details, so enum names have been amended to match what she provided
646+
<enum-type type-name='entity_site_link_type' base-type='int32_t'> bay12: EntitySiteProfileLocationType
647647
<enum-item name='None' value='-1'/>
648648
Probably inactive/failed/NA. Seen with status = 0/2/8/16/128/144/8192. Entities Civilization/SiteGovernment/NomadicGroup/Outcast (not all value/entity permutations)
649649
<enum-item name='All'/>
@@ -665,7 +665,7 @@
665665
Guild: All have status = 0 and the capital flag set.
666666
</enum-type>
667667

668-
<bitfield-type type-name='entity_site_link_flags' base-type='uint32_t'>
668+
<bitfield-type type-name='entity_site_link_flags' base-type='uint32_t'> bay12: ENTITY_SITE_PROFILE_FLAG_*
669669
<flag-bit name='residence' comment='site is residence'/>
670670
<flag-bit name='capital' comment='site is capital'/>
671671
<flag-bit name='fortress' comment='used at least by those castles which arent currently in'/>
@@ -685,12 +685,12 @@
685685
<flag-bit name='holy_city' comment='for the holy city of a religion'/>
686686
</bitfield-type>
687687

688-
<struct-type type-name='entity_site_link'> toady's name for this is entity_site_profilest
688+
<struct-type type-name='entity_site_link' original-name='entity_site_profilest'>
689689
<int32_t name="target" ref-target='world_site'/> this is a union in toady code but we can probably ignore that per putnam
690690
<int32_t name="entity_id" ref-target='historical_entity'/>
691691
<int32_t name="entity_cache_index" comment="not saved"/>
692692
<int32_t name='position_profile_id' init-value='-1' comment="index into entity.positions.assignments of Civilization (?)"/>
693-
<enum name='type' type-name='entity_site_link_type' base-type='int32_t' comment="called location in df source"/>
693+
<enum name='type' type-name='entity_site_link_type' comment="called location in df source"/>
694694
<int32_t name='start_hr' init-value='-1'/>
695695
<int32_t name='end_hr' init-value='-1'/>
696696
<bitfield name='flags' type-name='entity_site_link_flags'/>
@@ -717,7 +717,7 @@
717717
<int32_t name='last_check_controlling_population' init-value='0' comment="same value as previous field"/>
718718
the above are related to army.squads in some way
719719
<stl-vector name='ab_profile' comment="When a single element the first value makes sense as an abstract building related to the entity, but longer lists do not, including numbers larger than the number of abstract buildings">
720-
<pointer>
720+
<pointer> bay12: entity_site_ab_profilest
721721
<int32_t name='unk_1' init-value='-1'/>
722722
<int32_t name='unk_2' comment="1, 2, 5 seen"/>
723723
</pointer>
@@ -728,10 +728,11 @@
728728
<int32_t name='last_checked_army_year_tick' init-value='-1' since='v0.43.01' comment="paired with the previous field. Could be year/year_tick pair set to the start of play for all of these as all have the same number pair in the same save"/>
729729
</struct-type>
730730

731-
<bitfield-type type-name='undead_flags' base-type='uint16_t'>
731+
<bitfield-type type-name='undead_flags' base-type='uint16_t'> bay12: HF_KILL_FLAG_*, GEN_REF_EPOP_FLAG_* and GEN_REF_CREATURE_FLAG_*
732732
<flag-bit name='zombie'/>
733733
<flag-bit name='ghostly'/>
734734
</bitfield-type>
735+
735736
</data-definition>
736737

737738
<!--

0 commit comments

Comments
 (0)