Skip to content

Commit

Permalink
Merge pull request DFHack#341 from PatrikLundell/v4701
Browse files Browse the repository at this point in the history
identified temple/guild fields
  • Loading branch information
BenLubar authored Feb 10, 2020
2 parents 921dbb5 + f18d1e2 commit 233e944
Show file tree
Hide file tree
Showing 12 changed files with 171 additions and 32 deletions.
20 changes: 18 additions & 2 deletions df.announcements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
<enum-item name='CURRENT_DATE'/>

<enum-item name='NO_GRASP_FOR_PICKUP'/>
<enum-item name='TRAVEL_ADVISORY'/>
<enum-item name='CANNOT_CHOP_TREE' comment='formerly TRAVEL_ADVISORY'/>
<enum-item name='CANNOT_CLIMB'/>
<enum-item name='CANNOT_STAND'/>
<enum-item name='MUST_UNRETRACT_FIRST'/>
Expand Down Expand Up @@ -365,6 +365,22 @@
<enum-item name='RETURNING_RUMOR_RECEIVED'/>
<enum-item name='NEW_HOLDING'/>
<enum-item name='NEW_MARKET_LINK'/>
<enum-item name='EMERGENCY_TACTICAL_CONTROL' since='v0.47.01'/>
<enum-item name='AGREEMENT_SATISFIED' since='v0.47.01'/>
<enum-item name='AGREEMENT_WARNING' since='v0.47.01'/>

<enum-item name='AGREEMENT_ABANDONED' since='v0.47.01'/>
<enum-item name='NEW_GUILD' since='v0.47.01'/>
<enum-item name='CRIME_WITNESS_HANDOFF' since='v0.47.01'/>
<enum-item name='CRIME_WITNESS_STOLEN' since='v0.47.01'/>
<enum-item name='CRIME_WITNESS_ITEM_MOVED' since='v0.47.01'/>
<enum-item name='CRIME_WITNESS_ITEM_MISSING' since='v0.47.01'/>
<enum-item name='MOUNT' since='v0.47.01'/>
<enum-item name='CANNOT_MOUNT' since='v0.47.01'/>

<enum-item name='FAILED_MOUNT' since='v0.47.01'/>
<enum-item name='DISMOUNT' since='v0.47.01'/>
<enum-item name='FAILED_DISMOUNT' since='v0.47.01'/>
</enum-type>

<bitfield-type type-name='announcement_flags'>
Expand All @@ -379,7 +395,7 @@

<struct-type type-name='announcements'>
<static-array name='flags' type-name='announcement_flags'
count='325' index-enum='announcement_type'/>
count='339' index-enum='announcement_type'/>
<pointer name='unused' comment='needed to fix alignment on 64-bit platforms'/>
</struct-type>

Expand Down
2 changes: 2 additions & 0 deletions df.art.xml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
<enum-item name='ConsoleAudience'/>
<enum-item name='RefuseConsolation'/>
<enum-item name='OfferDifferentPerspective'/>
<enum-item name='Beseech' since='v0.47.01'/>
</enum-type>

A - even, B - uneven for tone patterns, A - unstressed, B - stressed for accent patterns
Expand Down Expand Up @@ -519,6 +520,7 @@
<enum-item name='BeFiery'/>
<enum-item name='BringSenseOfMotion'/>
<enum-item name='BeFiery2'/>
<enum-item name='WithFeeling' since='v0.47.01'/>
<enum-item name='FeelAgitated'/>
<enum-item name='BePassionate'/>
<enum-item name='Sparkle'/>
Expand Down
6 changes: 6 additions & 0 deletions df.d_init.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@
<static-array name='set_labor_lists' type-name='int16_t' count='2'/>

<int32_t name='graze_coefficient' since='v0.40.13'/>

<static-array name='temple_value_levels' type-name='int32_t' count='2' since='v0.47.01'/>
<static-array name='priesthood_unit_counts' type-name='int32_t' count='2' since='v0.47.01'/>
<static-array name='guildhall_value_levels' type-name='int32_t' count='2' since='v0.47.01'/>
<static-array name='guild_unit_counts' type-name='int32_t' count='2' since='v0.47.01'/>

<df-flagarray name='flags4' index-enum='d_init_flags4'/>
<enum name="post_prepare_embark_confirmation" type-name='d_init_embark_confirm'/>
<compound name='announcements' type-name='announcements'/>
Expand Down
2 changes: 2 additions & 0 deletions df.entities.xml
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@
<enum-item name='MilitaryUnit'/>
<enum-item name='Outcast'/>
<enum-item name='PerformanceTroupe'/>
<enum-item name='MerchantCompany'/>
<enum-item name='Guild'/>
</enum-type>

<struct-type type-name='historical_entity' key-field='id'
Expand Down
28 changes: 23 additions & 5 deletions df.history.xml
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@

<pointer name='info' type-name='historical_figure_info'/>

<int32_t name="unk_v47_1" comment="Did get a 'pointer' to something that definitely wasn't a site here"/>
<int32_t name="unk_v47_2"/>
<pointer name="unk_f0" type-name="world_site"/>
<pointer name="unk_f4" type-name="language_name"/>
<pointer name="unk_f8" type-name="world_underground_region"/>
Expand All @@ -519,6 +521,8 @@
<df-array name="unk_8" type-name='int16_t'/>
</pointer>
<int32_t name="unk_100"/>
<int32_t name="unk_v47_3" comment="ditto"/>
<int32_t name="unk_v47_4" comment="ditto"/>
<int32_t name='unk_v4019_1' init-value='-1' since='v0.40.17-19'/>
<padding size="1" comment='unknown size - not initialized or saved/loaded'/>
</struct-type>
Expand Down Expand Up @@ -550,6 +554,9 @@
<int32_t/>
<enum base-type='int16_t' name='profession' type-name='profession'/>
<int32_t name='civ' ref-target='historical_entity'/>
<int32_t name="unk_v47_1"/>
<int32_t name="unk_v47_2"/>
<int32_t name="unk_v47_3"/>
<stl-vector pointer-type='identity_unk_94'/>
<stl-vector pointer-type='identity_unk_94'/>
</struct-type>
Expand Down Expand Up @@ -2217,6 +2224,8 @@
<enum-item name='CEREMONY'/>
<enum-item name='PURGE'/>
<enum-item name='RAID'/>
<enum-item name='PERSECUTION'/>
<enum-item name='ENTITY_OVERTHROWN'/>
</enum-type>

<class-type type-name='history_event_collection' original-name='history_event_collectionst'
Expand Down Expand Up @@ -2454,6 +2463,18 @@
<int32_t name='ordinal'/>
</class-type>

<class-type type-name='history_event_collection_persecutionst' inherits-from='history_event_collection' since='v0.47.01'>
<int32_t name='site_id' ref-target='world_site'/>
<int32_t name='target_entity_id' ref-target='historical_entity'/>
<int32_t name='ordinal'/>
</class-type>

<class-type type-name='history_event_collection_entity_overthrownst' inherits-from='history_event_collection' since='v0.47.01'>
<int32_t name='site_id' ref-target='world_site'/>
<int32_t name='target_entity_id' ref-target='historical_entity'/>
<int32_t name='ordinal'/>
</class-type>

<enum-type type-name='era_type' base-type='int16_t'>
<enum-item name='ThreePowers'/>
<enum-item name='TwoPowers'/>
Expand Down Expand Up @@ -2506,31 +2527,28 @@

<compound name='event_collections'>
<stl-vector name='all' pointer-type='history_event_collection'/>
<static-array name='other' count='16' index-enum='history_event_collection_type'>
<static-array name='other' count='18' index-enum='history_event_collection_type'>
<stl-vector pointer-type='history_event_collection'/>
</static-array>
</compound>

<stl-vector name='eras' pointer-type='history_era'/>
<stl-vector name='unk1' type-name='int32_t'/>
<stl-vector name='unk2' type-name='int16_t'/>
<stl-vector since='v0.47.01'/>
<stl-vector since='v0.47.01'/>

<int32_t name='total_unk'/> some value during worldgen, and at the end equals to the number of entities plus that value
<int32_t name='total_powers' comment='also includes megabeasts'/>
<int32_t name='total_megabeasts'/>
<int32_t name='total_semimegabeasts'/>
<stl-vector/>
<static-array name='unk_v42_1' type-name='int16_t' count='28' since='v0.42.01'/> unsure but 16-bit values make more sense than 32-bit

<stl-vector since='v0.47.01' comment='Not hist figs, nor history events. When looked at like hist figs the first field looks like an index, and history events crashes DF'/>
<stl-vector name='live_megabeasts' pointer-type='historical_figure'/>
<stl-vector name='live_semimegabeasts' pointer-type='historical_figure'/>
<stl-vector name='unk_histfig_3' pointer-type='historical_figure'/>
<stl-vector name='unk_histfig_4' pointer-type='historical_figure'/>
<stl-vector name='unk_histfig_5' pointer-type='historical_figure'/>
<stl-vector since='v0.47.01'/>
<stl-vector since='v0.47.01'/>

11 - necromancers
<static-array name='unk_v40_1' since='v0.40.01' count='15'>
Expand Down
1 change: 1 addition & 0 deletions df.map.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
<flag-bit name='unk23'/>
<flag-bit name='dig_marked'/>
<flag-bit name='dig_auto'/>
<flag-bit name='varied_heavy_aquifer' since='v0.47.01'/> Set when block_flags.has_aquifer and designation[][].water_table are set and the aquifer isn't light (i.e. varied or heavy). Failed to find flag distinguishing varied from heavy.
</bitfield-type>

<bitfield-type type-name='block_flags'>
Expand Down
4 changes: 4 additions & 0 deletions df.military.xml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@
<int32_t name="unk_3c"/>
<int32_t name="unk_40"/>
<stl-vector name="unk_44" type-name='int32_t'/>
<int32_t name="unk_v47_1" comment="Could be before unk_44: haven't found any non zero unk_44"/>
<int32_t name="unk_v47_2"/>
<int32_t name="unk_v47_3"/>
<int32_t name="unk_v47_4"/>
<int32_t name="unk_50"/>
<stl-vector name="unk_54" type-name='int32_t'/>
<pointer name='mission_report' type-name='mission_report'/>
Expand Down
1 change: 1 addition & 0 deletions df.refs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@
<enum-type type-name='entity_entity_link_type' base-type='int16_t'>
<enum-item name='PARENT'/>
<enum-item name='CHILD'/>
<enum-item name='RELIGIOUS' comment='Seen between religion and merc company.' since='v0.47.01'/>
</enum-type>

<struct-type type-name='entity_entity_link'>
Expand Down
2 changes: 2 additions & 0 deletions df.units.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@
<enum-item name='SEE_THE_GREAT_NATURAL_SITES'/>
<enum-item name='IMMORTALITY'/>
<enum-item name='MAKE_A_GREAT_DISCOVERY'/>
<enum-item name='ATTAINING_RANK_IN_SOCIETY' since='v0.47.01'/>
<enum-item name='BATHING_THE_WORLD_IN_CHAOS' since='v0.47.01'/>
</enum-type>

<enum-type type-name='personality_facet_type' base-type='int16_t'>
Expand Down
10 changes: 7 additions & 3 deletions df.world-data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,20 @@
<int16_t ref-target='plant_raw' />
</stl-vector>

<int8_t name="dead_percentage" comment="% vegetation dead on embark. Can affect non evil regions"/>
<int8_t name="dead_percentage" comment="% vegetation dead on embark. Changes during history as evil spread needs death. Seems to always be 100% in those cases"/>
<bool name="unk_1e5" comment="Probably optionally set only on good and evil regions"/>
<bool name="unk_1e6" comment="Probably optionally set only on neutral regions"/>
<bool name="reanimating" comment="Indicates that region interaction is reanimating"/>
<bool name="reanimating" comment="Indicates that region interaction is reanimating"/>
<int32_t name="unk_1e8" since='v0.47.01'/>
<bool name='evil'/>
<bool name='good'/> -- At most one of 'evil' and 'good' is set at a time by DF.
<int16_t name="lake_surface"/>

<padding name="unk_1ed" size="34" comment='Seems to change randomly as the same save is loaded' since='v0.47.01'/>

<stl-vector name="forces" type-name='int32_t' ref-target='historical_figure' comment="historical figure IDs of force deities associated with the region"/>
<padding name="unk_200" size="4"/>

<padding name="unk_208" size="4" comment='Seems to change randomly as the same save is loaded'/>

<int32_t name="mid_x"/>
<int32_t name="mid_y"/>
Expand Down
93 changes: 71 additions & 22 deletions df.world-site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<enum-item name='UNDERWORLD_SPIRE'/>
<enum-item name='INN_TAVERN'/>
<enum-item name='LIBRARY'/>
<enum-item name='COUNTINGHOUSE'/>
<enum-item name='GUILDHALL'/>
<enum-item name='TOWER'/>
</enum-type>

<enum-type type-name='abstract_building_flags'>
Expand Down Expand Up @@ -85,6 +88,7 @@

<struct-type type-name='abstract_building_contents'> used within Temple, Library, and Inn/Tavern
<int32_t name="unk_e4"/>
<int32_t name="unk_v47_1" since='v0.47.01' comment='only seen 65535'/>
<int32_t name="desired_goblets"/>
<int32_t name="desired_instruments"/>
<int32_t name="desired_paper"/>
Expand Down Expand Up @@ -238,6 +242,20 @@
<compound name='contents' type-name='abstract_building_contents'/>
</class-type>

Something is wrong with this class, as getType returns the correct number, while getSubtype crashes DF, as does getName when trying to translate
the garbage returned. Counting House and Tower has been seen, but no Guildhall can be found in the test world.
<class-type type-name='abstract_building_counting_housest' inherits-from='abstract_building'>
<compound name='name' type-name='language_name'/>
</class-type>

<class-type type-name='abstract_building_guildhallst' inherits-from='abstract_building'>
<compound name='name' type-name='language_name'/>
</class-type>

<class-type type-name='abstract_building_towerst' inherits-from='abstract_building'>
<compound name='name' type-name='language_name'/>
</class-type>

<enum-type type-name='world_site_type' base-type='int16_t'>
<enum-item name='PlayerFortress'/>
<enum-item name='DarkFortress'/>
Expand All @@ -259,14 +277,40 @@
<enum-item name='Town' comment='not hamlet'/>
</enum-type>

<enum-type type-name="lair_type" base-type="int16_t" comment="Corresponds to the the LAIR creature raw token">
<enum-item name="SIMPLE_MOUND" value="0" />
<enum-item name="SIMPLE_BURROW" />
<enum-item name="LABYRINTH"/>
<enum-item name="SHRINE"/>
<enum-item name="WILDERNESS_LOCATION"/>
<enum-type type-name='fortress_type' base-type='int16_t'>
<enum-item name='NONE' value='-1'/>
<enum-item name='CASTLE'/>
<enum-item name='TOWER'/>
<enum-item name='MONASTERY'/>
<enum-item name='FORT'/>
</enum-type>


<enum-type type-name='monument_type' base-type='int16_t'>
<enum-item name='NONE' value='-1'/>
<enum-item name='TOMB'/>
<enum-item name='VAULT'/>
</enum-type>

<enum-type type-name='lair_type' base-type='int16_t'>
<enum-item name='NONE' value='-1'/>
<enum-item name='SIMPLE_MOUND' comment='Night creatures'/>
<enum-item name='SIMPLE_BURROW' comment='animal, (semi)megabeast, night creature(!)'/>
<enum-item name='LABYRINTH'/>
<enum-item name='SHRINE'/>
<enum-item name='WILDERNESS_LOCATION' comment='In mountains, hosting Rocs in vanilla'/>
</enum-type>

<struct-type type-name='property_ownership'>
<int32_t name="index"/>
<bool name="is_concrete_property" comment="true if house [property_index = 4 only one seen], or index into buildings"/>
<padding size='3'/>
<int32_t name='property_index' comment="index into buildings when is_concrete_property is false. Only seen 4 = house with is_concrete_property = true"/>
<int32_t name="unk_hfid" init-value='-1' ref-target='historical_figure' comment="Always same as owner_hfid when set, but not always set when that field is."/>
<int32_t name="owner_entity_id" init-value='-1' ref-target='historical_entity' comment='Mutually exclusive with owner_hfid. All seen were merchant companies.'/>
<int32_t name="owner_hfid" init-value='-1' ref-target='historical_figure'/>
<int32_t name="unk_owner_entity_id" init-value ='-1' ref-target='historical_entity' comment="Seen only in subset of owner_entity_id case, and always same value"/>
</struct-type> -- Cannot rule out the type having additional fields, although the 8 following bytes were all 0 in all cases in the save examined.

<struct-type type-name='world_site' key-field='id'
instance-vector='$global.world.world_data.sites'>
<compound name='name' type-name='language_name'/>
Expand Down Expand Up @@ -341,14 +385,13 @@
<stl-vector type-name='int32_t'/>
<stl-vector type-name='int32_t'/>
</pointer>
<int32_t name="unk_11c"/>
<int32_t name="unk_120"/>
<int32_t name="unk_124"/>
<int32_t name="unk_128"/> "site_level" is in here somewhere

<int32_t name="unk_11c" comment='Caves have non zero numbers. No others.'/>
<int32_t name="unk_120" comment='Subset of caves can have non zero.'/>
<int32_t name="unk_124" comment='Monument 0, LairShrine 5, Camp 20, others varying'/>
<int32_t name="unk_128" comment=' "site_level" is in here somewhere. Same as for unk_124, but varying ones always less/equal'/>
<static-array type-name='int32_t' count='8'/>

<stl-vector name="unk_13c" comment='mountain halls'>
<stl-vector name="unk_13c" comment='MountainHall, Town, DarkFortress, but not all'>
<pointer>
<int32_t name="unk_0"/>
<int32_t name="unk_4"/>
Expand All @@ -370,25 +413,28 @@
<int32_t name="unk_30"/>
</pointer>
</stl-vector>

<stl-vector name="unk_v47_1" since='0.47.01' comment='Varying types of habitation can have this'/>
<df-flagarray name='flags' index-enum='world_site_flags'/>

<stl-vector name="buildings" pointer-type='abstract_building'/>

<int32_t name="next_building_id"/>
<int32_t name="unk_v47_2" since='0.47.01' comment='constant 0'/>
<stl-vector name="property_ownership" since='0.47.01' pointer-type='property_ownership'/>
<int32_t name="unk_v47_4" since='0.47.01' comment='0 or various small numbers for habitations'/>
<int32_t name="created_tick"/>
<int32_t name="created_year"/>
<int32_t name="unk_170"/>
<int32_t name="unk_174"/>
<int32_t name="unk_170" comment='constant 0'/>
<int32_t name="unk_174" comment='constant 0'/>

<compound name='unk_178' type-name='coord'/>

<pointer name="realization" type-name='world_site_realization'/>

<pointer name="subtype_info">
<int16_t name="is_tower" init-value='-1' comment='1 => not fortress'/>
<int16_t name="is_monument" init-value='-1' comment='not tomb'/>
<enum name="lair_type" type-name='lair_type' base-type='int16_t'/>
<enum base-type='int16_t' name="fortress_type" type-name='fortress_type' init-value='NONE' comment='Only when site.type=Fortress'/>
<enum base-type='int16_t' name="monument_type" type-name='monument_type' init-value='NONE' comment='Only when site.type=Monument'/>
<enum base-type='int16_t' name="lair_type" type-name='lair_type' init-value='NONE' comment='Only when site.type=LairShrine'/>
<stl-vector name="unk_8" type-name='int16_t'/>
<int32_t name="unk_14" init-value='-1000000'/>
<int32_t name="unk_18" init-value='-1000000'/>
Expand All @@ -414,6 +460,9 @@
<int32_t name='is_mountain_halls' since='v0.40.01'/>
<int32_t name='is_fortress' since='v0.40.01'/>

<int32_t name="unk_v74_2"/>
<int32_t name="unk_v74_3"/>

<stl-vector name="unk_v40_4a" since='v0.40.01'>
<pointer>
<int32_t name="unk_0"/>
Expand Down Expand Up @@ -481,9 +530,9 @@
<static-array count='16'><static-array count='16' type-name='int32_t'/></static-array>
</pointer>
</stl-vector>
<int32_t name='unk_v43_3' since='v0.43.01'/>
<int32_t name='unk_v43_3' comment='constant 0?' since='v0.43.01'/>

<int32_t name='unk_v40_5' since='v0.40.01'/>
<int32_t name='unk_v40_5' comment='constant -1?' since='v0.40.01'/>

<pointer name="unk_188">
<stl-vector>
Expand Down
Loading

0 comments on commit 233e944

Please sign in to comment.