Merge branch 'dotnet'

develop
doomchild 2010-09-16 09:06:12 -05:00
commit 36400f2833
22 changed files with 951 additions and 725 deletions

@ -144,363 +144,216 @@
<Profession name="None" id="90" military="false" can_assign_labors="true" />
</Professions>
<Jobs>
TODO: Parse this and turn it into Job tags
<!--
[dwarf_jobs]
size=212
0/name = "Carve Fortification"
0/type = DIG
1/name = "Detail Wall"
1/type = TROWEL
2/name = "Detail Floor"
2/type = TROWEL
3/name = "Dig"
3/type = DIG
4/name = "Carve Upward Staircase"
4/type = DIG
5/name = "Carve Downward Staircase"
5/type = DIG
6/name = "Carve Up/Down Staircase"
6/type = DIG
7/name = "Carve Ramp"
7/type = DIG
8/name = "Dig Channel"
8/type = DIG
9/name = "Fell Tree"
9/type = CUT
10/name = "Gather Plants"
11/name = "Remove Construction"
11/type = BUILD
12/name = "Collect Webs"
12/type = HAUL
13/name = "Bring Item to Depot"
13/type = HAUL
14/name = "Bring Item to Shop"
14/type = HAUL
15/name = "Eat"
15/type = FOOD
16/name = "Get Provisions"
16/type = FOOD
17/name = "Drink"
17/type = DRINK
18/name = "Drink"
18/type = DRINK
19/name = "Fill Waterskin"
19/type = DRINK
20/name = "Fill Waterskin"
20/type = DRINK
21/name = "Sleep"
21/type = REST
22/name = "Collect Sand"
22/type = HAUL
23/name = "Fish"
24/name = "Hunt"
25/name = "Hunt for Small Creature"
26/name = "Kidnap"
26/type = FIGHT
27/name = "Beat Criminal"
27/type = FIGHT
28/name = "Starting Fist Fight"
28/type = FIGHT
29/name = "Collect Taxes"
30/name = "Guard Tax Collector"
30/type = FIGHT
31/name = "Catch Live Land Animal"
32/name = "Catch Live Fish"
33/name = "Return Kill"
33/type = HAUL
34/name = "Check Chesk"
34/type = SEEK
35/name = "Store Owned Item"
35/type = HAUL
36/name = "Place Item in Tomb"
36/type = HAUL
37/name = "Store Item in Stockpile"
37/type = HAUL
38/name = "Store Item in Bag"
38/type = HAUL
39/name = "Store Item in Hospital"
39/type = HAUL
40/name = "Store Item in Chest"
40/type = HAUL
41/name = "Store Item in Cabinet"
41/type = HAUL
42/name = "Store Weapon"
42/type = HAUL
43/name = "Store Armor"
43/type = HAUL
44/name = "Store Item in Barrel"
44/type = HAUL
45/name = "Store Item in Bin"
45/type = HAUL
46/name = "Seek Artifact"
46/type = SEEK
47/name = "Seek Infant"
47/type = SEEK
48/name = "Attend Party"
48/type = DRINK
49/name = "Go Shopping"
50/name = "Go Shopping"
51/name = "Clean"
52/name = "Rest"
52/type = REST
53/name = "Pickup Equipment"
53/type = SEEK
54/name = "Dump Item"
54/type = HAUL
55/name = "Strange Mood Crafter"
55/type = MOOD
56/name = "Strange Mood Jeweller"
56/type = MOOD
57/name = "Strange Mood Forge"
57/type = MOOD
58/name = "Strange Mood Magma Forge"
58/type = MOOD
59/name = "Strange Mood Brooding"
59/type = MOOD
60/name = "Strange Mood Fell"
60/type = MOOD
61/name = "Strange Mood Carpenter"
61/type = MOOD
62/name = "Strange Mood Mason"
62/type = MOOD
63/name = "Strange Mood Bowyer"
63/type = MOOD
64/name = "Strange Mood Tanner"
64/type = MOOD
65/name = "Strange Mood Weaver"
65/type = MOOD
66/name = "Strange Mood Glassmaker"
66/type = MOOD
67/name = "Strange Mood Mechanics"
67/type = MOOD
68/name = "Construct Building"
68/type = BUILD
69/name = "Construct Door"
68/type = BUILD
70/name = "Construct Floodgate"
70/type = BUILD
71/name = "Construct ?? Bed"
71/type = BUILD
72/name = "Construct ?? Chair/Throne"
72/type = BUILD
73/name = "Construct ?? Casket/Sarcophagus/Coffin"
73/type = BUILD
74/name = "Construct ?? Table"
74/type = BUILD
75/name = "Construct ?? Box/Chest/Bag/Coffer"
75/type = BUILD
76/name = "Construct ?? Bin"
76/type = BUILD
77/name = "Construct ?? Armor Stand"
77/type = BUILD
78/name = "Construct ?? Weapon Rack"
78/type = BUILD
79/name = "Construct ?? Cabinet"
79/type = BUILD
80/name = "Construct ?? Statue"
80/type = BUILD
81/name = "Construct ?? Blocks"
81/type = BUILD
82/name = "Make Raw ??"
83/name = "Make ?? Crafts"
84/name = "Mint ?? Coins"
85/name = "Cut ?A?"
86/name = "Cut ?B?"
87/name = "Encrust ?something? with ?somethings?"
88/name = "Encrust ?something? with ?somethings?"
89/name = "Destroy Building"
89/type = BUILD
90/name = "Smelt Ore"
90/type = FURNACE
91/name = "Melt a Metal Object"
91/type = FORGE
92/name = "Extract Metal Strands"
92/type = FORGE
93/name = "Plant Seeds"
94/name = "Harvest Plants"
95/name = "Train Hunting Animal"
95/type = ANIMAL
96/name = "Train War Animal"
96/type = ANIMAL
99/name = "Construct Catapult Parts"
100/name = "Forge ?? Anvil"
100/type = FORGE
101/name = "Construct Catapult Parts"
102/name = "Construct Ballista Parts"
103/name = "Forge/Make A"
103/type = FORGE
104/name = "Stud with ?something?"
105/name = "Butcher an Animal"
106/name = "Prepare a Raw Fish"
107/name = "Mill Plants"
108/name = "Bait Trap with Meat/Gem/Fish"
109/name = "Milk Creature"
110/name = "Make Cheese"
111/name = "Process Plants"
112/name = "Process Plants (Bag)"
113/name = "Process Plants (Vial)"
114/name = "Process Plants (Barrel)"
115/name = "Prepare ?? Meal"
116/name = "Weave ?? into ??"
117/name = "Forge/Make ?? something"
117/type = BUILD
118/name = "Weave Thread"
119/name = "Forge/Make D"
119/type = FORGE
120/name = "Forge/Make E"
120/type = FORGE
121/name = "Forge/Make F"
121/type = FORGE
122/name = "Forge/Make Waterskin/Vial/Flask"
122/type = FORGE
123/name = "Forge Rope"
123/type = FORGE
124/name = "Forge Flask"
124/type = FORGE
125/name = "Forge Goblet"
125/type = FORGE
126/name = "Forge Instrument"
126/type = FORGE
127/name = "Forge Toy"
127/type = FORGE
128/name = "Forge Animal Trap"
128/type = FORGE
129/name = "Forge Barrel"
129/type = FORGE
130/name = "Make Totel"
130/type = FORGE
131/name = "Forge Bolts"
131/type = FORGE
132/name = "Decorate With ?something?"
133/name = "Forge/Make G"
133/type = FORGE
134/name = "Decorate With Bone"
135/name = "Make Backpack"
136/name = "Make Quiver"
137/name = "Load Catapult"
138/name = "Load Ballista"
139/name = "Fire Catapult"
140/name = "Fire Ballista"
141/name = "Construct Mechanisms"
141/type = BUILD
142/name = "Fire Ballista"
143/name = "Load Cage Trap"
144/name = "Load Stone Trap"
145/name = "Load Weapon Trap"
146/name = "Clean Trap"
147/name = "Cast Spell"
148/name = "Link a Building to Trigger"
149/name = "Pull the Lever"
150/name = "Brew Drink"
150/type = DRINK
151/name = "Extract from Plants"
152/name = "Extract from Raw Fish"
153/name = "Extract from Land Animal"
154/name = "Tame Small Animal"
154/type = ANIMAL
155/name = "Tame ?something?"
155/type = ANIMAL
156/name = "Chain Animal"
156/type = ANIMAL
157/name = "Unchain Animal"
157/type = ANIMAL
158/name = "Unchain Pet"
158/type = ANIMAL
159/name = "Release Large Creature"
159/type = ANIMAL
160/name = "Release Pet"
160/type = ANIMAL
161/name = "Release Small Creature"
161/type = ANIMAL
162/name = "Handle Small Creature"
162/type = ANIMAL
163/name = "Handle Large Creature"
163/type = ANIMAL
164/name = "Cage Large Creature"
164/type = ANIMAL
165/name = "Cage Small Creature"
165/type = ANIMAL
166/name = "Recover Wounded"
166/type = MEDICAL
167/name = "Diagnose Patient"
167/type = MEDICAL
168/name = "Immobilize Break"
168/type = MEDICAL
169/name = "Dress Wound"
169/type = MEDICAL
170/name = "Clean Patient"
170/type = MEDICAL
171/name = "Surgery"
171/type = MEDICAL
172/name = "Suture"
172/type = MEDICAL
173/name = "Set Bone"
173/type = MEDICAL
174/name = "Place In Traction"
174/type = MEDICAL
175/name = "Drain Aquarium"
176/name = "Fill Aquarium"
177/name = "Fill Pond"
178/name = "Give Water"
178/type = MEDICAL
179/name = "Give Food"
179/type = MEDICAL
180/name = "Give Water"
180/type = MEDICAL
181/name = "Give Food"
181/type = MEDICAL
182/name = "Recover Pet"
183/name = "Pit/Pond Large Animal"
183/type = ANIMAL
184/name = "Pit/Pond Small Animal"
184/type = ANIMAL
185/name = "Slaughter Animal"
185/type = ANIMAL
186/name = "Make Charcoal"
186/type = FURNACE
187/name = "Make Ash"
187/type = FURNACE
188/name = "Make Lye"
189/name = "Make Potash From Lye"
190/name = "Fertilize Field"
191/name = "Make Potash From Ash"
192/name = "Dye Thread"
193/name = "Dye Cloth"
194/name = "Sew ?? Image"
195/name = "Manage Work Orders"
195/type = ADMIN
196/name = "Operate Pump"
197/name = "Manage Work Orders"
197/type = ADMIN
198/name = "Update Stockpile Records"
198/type = ADMIN
199/name = "Trade at Depot"
199/type = ADMIN
200/name = "Construct ?? Hatch Cover"
200/type = BUILD
201/name = "Construct ?? Grate"
201/type = BUILD
202/name = "Remove Stairs/Ramps"
202/type = DIG
203/name = "Construct ?? Quern"
203/type = BUILD
205/name = "Upgrade Squad Equipment"
205/type = HAUL
206/name = "Prepare Equipment Manifests"
206/type = ADMIN
207/name = "Construct ?? Splint"
207/type = BUILD
208/name = "Construct ?? Crutch"
208/type = BUILD
209/name = "Construct Traction Bench"
209/type = BUILD
210/name = "Clean Self"
211/name = "Bring Crutch"
211/type = MEDICAL
212/name = "Apply Cast"
212/type = MEDICAL
-->
<Job id="0" name = "Carve Fortification" />
<Job id="1" name = "Detail Wall" />
<Job id="2" name = "Detail Floor" />
<Job id="3" name = "Dig" />
<Job id="4" name = "Carve Upward Staircase" />
<Job id="5" name = "Carve Downward Staircase" />
<Job id="6" name = "Carve Up/Down Staircase" />
<Job id="7" name = "Carve Ramp" />
<Job id="8" name = "Dig Channel" />
<Job id="9" name = "Fell Tree" />
<Job id="10" name = "Gather Plants" />
<Job id="11" name = "Remove Construction" />
<Job id="12" name = "Collect Webs" />
<Job id="13" name = "Bring Item to Depot" />
<Job id="14" name = "Bring Item to Shop" />
<Job id="15" name = "Eat" />
<Job id="16" name = "Get Provisions" />
<Job id="17" name = "Drink" />
<Job id="18" name = "Drink" />
<Job id="19" name = "Fill Waterskin" />
<Job id="20" name = "Fill Waterskin" />
<Job id="21" name = "Sleep" />
<Job id="22" name = "Collect Sand" />
<Job id="23" name = "Fish" />
<Job id="24" name = "Hunt" />
<Job id="25" name = "Hunt for Small Creature" />
<Job id="26" name = "Kidnap" />
<Job id="27" name = "Beat Criminal" />
<Job id="28" name = "Starting Fist Fight" />
<Job id="29" name = "Collect Taxes" />
<Job id="30" name = "Guard Tax Collector" />
<Job id="31" name = "Catch Live Land Animal" />
<Job id="32" name = "Catch Live Fish" />
<Job id="33" name = "Return Kill" />
<Job id="34" name = "Check Chesk" />
<Job id="35" name = "Store Owned Item" />
<Job id="36" name = "Place Item in Tomb" />
<Job id="37" name = "Store Item in Stockpile" />
<Job id="38" name = "Store Item in Bag" />
<Job id="39" name = "Store Item in Hospital" />
<Job id="40" name = "Store Item in Chest" />
<Job id="41" name = "Store Item in Cabinet" />
<Job id="42" name = "Store Weapon" />
<Job id="43" name = "Store Armor" />
<Job id="44" name = "Store Item in Barrel" />
<Job id="45" name = "Store Item in Bin" />
<Job id="46" name = "Seek Artifact" />
<Job id="47" name = "Seek Infant" />
<Job id="48" name = "Attend Party" />
<Job id="49" name = "Go Shopping" />
<Job id="50" name = "Go Shopping" />
<Job id="51" name = "Clean" />
<Job id="52" name = "Rest" />
<Job id="53" name = "Pickup Equipment" />
<Job id="54" name = "Dump Item" />
<Job id="55" name = "Strange Mood Crafter" />
<Job id="56" name = "Strange Mood Jeweller" />
<Job id="57" name = "Strange Mood Forge" />
<Job id="58" name = "Strange Mood Magma Forge" />
<Job id="59" name = "Strange Mood Brooding" />
<Job id="60" name = "Strange Mood Fell" />
<Job id="61" name = "Strange Mood Carpenter" />
<Job id="62" name = "Strange Mood Mason" />
<Job id="63" name = "Strange Mood Bowyer" />
<Job id="64" name = "Strange Mood Tanner" />
<Job id="65" name = "Strange Mood Weaver" />
<Job id="66" name = "Strange Mood Glassmaker" />
<Job id="67" name = "Strange Mood Mechanics" />
<Job id="68" name = "Construct Building" />
<Job id="69" name = "Construct Door" />
<Job id="70" name = "Construct Floodgate" />
<Job id="71" name = "Construct ?? Bed" />
<Job id="72" name = "Construct ?? Chair/Throne" />
<Job id="73" name = "Construct ?? Casket/Sarcophagus/Coffin" />
<Job id="74" name = "Construct ?? Table" />
<Job id="75" name = "Construct ?? Box/Chest/Bag/Coffer" />
<Job id="76" name = "Construct ?? Bin" />
<Job id="77" name = "Construct ?? Armor Stand" />
<Job id="78" name = "Construct ?? Weapon Rack" />
<Job id="79" name = "Construct ?? Cabinet" />
<Job id="80" name = "Construct ?? Statue" />
<Job id="81" name = "Construct ?? Blocks" />
<Job id="82" name = "Make Raw ??" />
<Job id="83" name = "Make ?? Crafts" />
<Job id="84" name = "Mint ?? Coins" />
<Job id="85" name = "Cut ?A?" />
<Job id="86" name = "Cut ?B?" />
<Job id="87" name = "Encrust ?something? with ?somethings?" />
<Job id="88" name = "Encrust ?something? with ?somethings?" />
<Job id="89" name = "Destroy Building" />
<Job id="90" name = "Smelt Ore" />
<Job id="91" name = "Melt a Metal Object" />
<Job id="92" name = "Extract Metal Strands" />
<Job id="93" name = "Plant Seeds" />
<Job id="94" name = "Harvest Plants" />
<Job id="95" name = "Train Hunting Animal" />
<Job id="96" name = "Train War Animal" />
<Job id="99" name = "Construct Catapult Parts" />
<Job id="100" name = "Forge ?? Anvil" />
<Job id="101" name = "Construct Catapult Parts" />
<Job id="102" name = "Construct Ballista Parts" />
<Job id="103" name = "Forge/Make A" />
<Job id="104" name = "Stud with ?something?" />
<Job id="105" name = "Butcher an Animal" />
<Job id="106" name = "Prepare a Raw Fish" />
<Job id="107" name = "Mill Plants" />
<Job id="108" name = "Bait Trap with Meat/Gem/Fish" />
<Job id="109" name = "Milk Creature" />
<Job id="110" name = "Make Cheese" />
<Job id="111" name = "Process Plants" />
<Job id="112" name = "Process Plants (Bag)" />
<Job id="113" name = "Process Plants (Vial)" />
<Job id="114" name = "Process Plants (Barrel)" />
<Job id="115" name = "Prepare ?? Meal" />
<Job id="116" name = "Weave ?? into ??" />
<Job id="117" name = "Forge/Make ?? something" />
<Job id="118" name = "Weave Thread" />
<Job id="119" name = "Forge/Make D" />
<Job id="120" name = "Forge/Make E" />
<Job id="121" name = "Forge/Make F" />
<Job id="122" name = "Forge/Make Waterskin/Vial/Flask" />
<Job id="123" name = "Forge Rope" />
<Job id="124" name = "Forge Flask" />
<Job id="125" name = "Forge Goblet" />
<Job id="126" name = "Forge Instrument" />
<Job id="127" name = "Forge Toy" />
<Job id="128" name = "Forge Animal Trap" />
<Job id="129" name = "Forge Barrel" />
<Job id="130" name = "Make Totel" />
<Job id="131" name = "Forge Bolts" />
<Job id="132" name = "Decorate With ?something?" />
<Job id="133" name = "Forge/Make G" />
<Job id="134" name = "Decorate With Bone" />
<Job id="135" name = "Make Backpack" />
<Job id="136" name = "Make Quiver" />
<Job id="137" name = "Load Catapult" />
<Job id="138" name = "Load Ballista" />
<Job id="139" name = "Fire Catapult" />
<Job id="140" name = "Fire Ballista" />
<Job id="141" name = "Construct Mechanisms" />
<Job id="142" name = "Fire Ballista" />
<Job id="143" name = "Load Cage Trap" />
<Job id="144" name = "Load Stone Trap" />
<Job id="145" name = "Load Weapon Trap" />
<Job id="146" name = "Clean Trap" />
<Job id="147" name = "Cast Spell" />
<Job id="148" name = "Link a Building to Trigger" />
<Job id="149" name = "Pull the Lever" />
<Job id="150" name = "Brew Drink" />
<Job id="151" name = "Extract from Plants" />
<Job id="152" name = "Extract from Raw Fish" />
<Job id="153" name = "Extract from Land Animal" />
<Job id="154" name = "Tame Small Animal" />
<Job id="155" name = "Tame ?something?" />
<Job id="156" name = "Chain Animal" />
<Job id="157" name = "Unchain Animal" />
<Job id="158" name = "Unchain Pet" />
<Job id="159" name = "Release Large Creature" />
<Job id="160" name = "Release Pet" />
<Job id="161" name = "Release Small Creature" />
<Job id="162" name = "Handle Small Creature" />
<Job id="163" name = "Handle Large Creature" />
<Job id="164" name = "Cage Large Creature" />
<Job id="165" name = "Cage Small Creature" />
<Job id="166" name = "Recover Wounded" />
<Job id="167" name = "Diagnose Patient" />
<Job id="168" name = "Immobilize Break" />
<Job id="169" name = "Dress Wound" />
<Job id="170" name = "Clean Patient" />
<Job id="171" name = "Surgery" />
<Job id="172" name = "Suture" />
<Job id="173" name = "Set Bone" />
<Job id="174" name = "Place In Traction" />
<Job id="175" name = "Drain Aquarium" />
<Job id="176" name = "Fill Aquarium" />
<Job id="177" name = "Fill Pond" />
<Job id="178" name = "Give Water" />
<Job id="179" name = "Give Food" />
<Job id="180" name = "Give Water" />
<Job id="181" name = "Give Food" />
<Job id="182" name = "Recover Pet" />
<Job id="183" name = "Pit/Pond Large Animal" />
<Job id="184" name = "Pit/Pond Small Animal" />
<Job id="185" name = "Slaughter Animal" />
<Job id="186" name = "Make Charcoal" />
<Job id="187" name = "Make Ash" />
<Job id="188" name = "Make Lye" />
<Job id="189" name = "Make Potash From Lye" />
<Job id="190" name = "Fertilize Field" />
<Job id="191" name = "Make Potash From Ash" />
<Job id="192" name = "Dye Thread" />
<Job id="193" name = "Dye Cloth" />
<Job id="194" name = "Sew ?? Image" />
<Job id="195" name = "Manage Work Orders" />
<Job id="196" name = "Operate Pump" />
<Job id="197" name = "Manage Work Orders" />
<Job id="198" name = "Update Stockpile Records" />
<Job id="199" name = "Trade at Depot" />
<Job id="200" name = "Construct ?? Hatch Cover" />
<Job id="201" name = "Construct ?? Grate" />
<Job id="202" name = "Remove Stairs/Ramps" />
<Job id="203" name = "Construct ?? Quern" />
<Job id="205" name = "Upgrade Squad Equipment" />
<Job id="206" name = "Prepare Equipment Manifests" />
<Job id="207" name = "Construct ?? Splint" />
<Job id="208" name = "Construct ?? Crutch" />
<Job id="209" name = "Construct Traction Bench" />
<Job id="210" name = "Clean Self" />
<Job id="211" name = "Bring Crutch" />
<Job id="212" name = "Apply Cast" />
</Jobs>
<Skills>
<Skill name="Mining" id="0" />
@ -892,7 +745,7 @@
</Group>
</Group>
<Group name="Creatures" description="Offsets used by the Creatures module.">
<Address name="creature_vector"/>
<Address name="vector"/>
<Address name="current_race" description="Index of the current player race." />
<Address name="current_civ" description="Index of the current player civilization." />
<Group name="creature">
@ -939,11 +792,11 @@
<Offset name="type" description="seems to be just like the old occupations" />
<Offset name="materials_vector" />
<Group name="material">
<Offset name="material_maintype" description="like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ..." />
<Offset name="material_sectype1" description="subsubtype ?" />
<Offset name="material_sectype2" description="subtype ?" />
<Offset name="material_sectype3" description="index of material (for example, 2 is for silver)" />
<Offset name="material_flags" description="set only for shell / bone mood requirements ?" />
<Offset name="maintype" description="like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ..." />
<Offset name="sectype1" description="subsubtype ?" />
<Offset name="sectype2" description="subtype ?" />
<Offset name="sectype3" description="index of material (for example, 2 is for silver)" />
<Offset name="flags" description="set only for shell / bone mood requirements ?" />
</Group>
</Group>
</Group>
@ -953,7 +806,7 @@
<Address name="organics_plants" description="plant matter" />
<Address name="organics_trees" description="just wood" />
<Address name="creature_type_vector" description="A vector of creature races" />
<Address name="other" description="Base material types? Code suggests it's a null-terminated string of string pointers?" />
<Address name="other" description="Base material types? Code suggests it's a null-terminated string of string pointers? Is this used at all?" />
<Group name="creature" description="Creature race objects">
<Offset name="caste_vector" description="A race is divided into castes. Normally male and female."/>
<Offset name="extract_vector"/>
@ -1032,6 +885,7 @@
<Group name="World">
<Address name="current_tick" description="Current time of the year" />
<Address name="current_year" description="Current year" />
<Address name="current_weather" description="5x5 array of bytes for surrounding biomes. For each: 0=clear, 1=raining, 2=snowing." />
</Group>
</Offsets>
</Base>
@ -1168,7 +1022,7 @@
</Group>
</Group>
<Group name="Creatures">
<Address name="creature_vector" value="0x0166ecc4" />
<Address name="vector" value="0x0166ecc4" />
<Address name="current_race" value="0x01470fbc" />
<Address name="current_civ" value="0x01470fb0" />
<Group name="creature">
@ -1214,11 +1068,11 @@
<Offset name="type" value="0x8" /> seems to be just like the old occupations
<Offset name="materials_vector" value="0xa4" />
<Group name="material">
<Offset name="material_maintype" value="0x0" /> like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ...
<Offset name="material_sectype1" value="0x2" /> subsubtype ?
<Offset name="material_sectype2" value="0x4" /> subtype ?
<Offset name="material_sectype3" value="0x8" /> index of material (for example, 2 is for silver)
<Offset name="material_flags" value="0x18" /> set only for shell / bone mood requirements ?
<Offset name="maintype" value="0x0" /> like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ...
<Offset name="sectype1" value="0x2" /> subsubtype ?
<Offset name="sectype2" value="0x4" /> subtype ?
<Offset name="sectype3" value="0x8" /> index of material (for example, 2 is for silver)
<Offset name="flags" value="0x18" /> set only for shell / bone mood requirements ?
</Group>
</Group>
</Group>
@ -1350,7 +1204,7 @@
</Group>
</Group>
<Group name="Creatures">
<Address name="creature_vector" value="0x166FD0C" />
<Address name="vector" value="0x166FD0C" />
<Group name="creature">
<Group name="advanced">
<Offset name="artifact_name" value="0x6D4" />
@ -1368,6 +1222,7 @@
<Address name="organics_plants" value="0x16B0D7C" /><!--plant matter, WORLD + 0x54BAC-->
<Address name="organics_trees" value="0x16B0DAC" /><!--just wood, WORLD + 0x54BDC-->
<Address name="creature_type_vector" value="0x16B0EA0" /><!--WORLD + 0x54CD0-->
<Address name="other" value="0x16BA114" />
<Group name="descriptors">
<Address name="vectors_start" value="0x16B9780" />
<Offset name="rawname" value="0x0" />
@ -1419,7 +1274,7 @@
<PETimeStamp value="0x4bf014fa" />
<Offsets>
<Group name="Creatures">
<Address name="creature_vector" value="0x167870C" />
<Address name="vector" value="0x167870C" />
<Address name="current_race" value="0x1471FBC" />
<Address name="current_civ" value="0x1471FB0" />
</Group>
@ -1430,6 +1285,7 @@
<Address name="organics_plants" value="0x16bd0e0" />
<Address name="organics_trees" value="0x16bd110" />
<Address name="creature_type_vector" value="0x16BD204" />
<Address name="other" value="0x16C6478"/>
<Group name="descriptors">
<Address name="colors_vector" value="0x16C5ACC" />
<Address name="vectors_start" value="0x16C5AE4" />
@ -1553,7 +1409,7 @@
<Address name="translation_vector" value="0x16D33FC" />
</Group>
<Group name="Creatures">
<Address name="creature_vector" value="0x168E73C" />
<Address name="vector" value="0x168E73C" />
<Address name="current_race" value="0x014b9f1c" />
<Group name="creature">
<Group name="advanced">
@ -1593,9 +1449,37 @@
<Group name="Position">
<Address name="screen_tiles_pointer" value="0x18313D0" />
</Group>
<Group name="World">
<Address name="current_weather" value="0x14BCDEE" />
</Group>
</Offsets>
</Version>
<Version name="v0.31.13 SDL" os="windows" base="v0.31.12 SDL">
<MD5 value="59f194b0b2103ca5df7601a01ce21280" />
<PETimeStamp value="0x4C90ADA8" />
<Offsets>
<Address name="WORLD" value="0x016425A0" />
0x01482874 - current race
<Group name="Position">
<Address name="cursor_xyz" value="0xac77f0" />
<Address name="window_x" value="0xe42c74" />
<Address name="window_y" value="0xe70d48" />
<Address name="window_z" value="0xe70d24" />
<Address name="screen_tiles_pointer" value="0x01480684" /><!-- BAD, not a pointer! -->
<Address name="window_dims" value="0xac807c" />
</Group>
<Group name="GUI">
<Address name="pause_state" value="0x147E971" />
</Group>
<Group name="World">
<Address name="current_weather" value="0x147F94E 0x14BCDEE" /><!-- bad, not 25 byte array! -->
</Group>
<Group name="Vegetation">
<Address name="vector" value="0x1656EF0" />
</Group>
</Offsets>
</Version>
31.13 WEATHER_START 0147E94E
.-"""-.
' \
|,. ,-. | _________________________
@ -1700,7 +1584,7 @@
</Group>
</Group>
<Group name="Creatures">
<Address name="creature_vector" value="0x92D9AC0" />
<Address name="vector" value="0x92D9AC0" />
<Address name="current_race" value="0x92C1628" />
<Address name="current_civ" value="0x92C161C" />
<Group name="creature" valid="verify" >
@ -1708,7 +1592,7 @@
<Offset name="custom_profession" value="0x3c" />
<Offset name="profession" value="0x40" />
<Offset name="race" value="0x44" />
<Offset name="position" value="0x90" />
<Offset name="position" value="0x48" />
<Offset name="flags1" value="0x8C" />
<Offset name="flags2" value="0x90" />
<Offset name="caste" value="0xA4" />
@ -1731,24 +1615,26 @@
<Offset name="happiness" value="0x5AC" />
</Group>
</Group>
<!--
The vector is bad.
<Group name="soul" valid="verify">
<Offset name="name" value="0x0" />
<Offset name="mental" value="0x88" />
<Offset name="skills_vector" value="0x1C4" /> CHMOD
<Offset name="traits" value="0x1DC" />
</Group>
-->
<!--
<Group name="job">
<Offset name="id" value="0x0" /> Incrementaly assigned
<Offset name="type" value="0x8" /> seems to be just like the old occupations
<Offset name="materials_vector" value="0xa4" />
<Group name="material">
<Offset name="material_maintype" value="0x0" /> like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ...
<Offset name="material_sectype1" value="0x2" /> subsubtype ?
<Offset name="material_sectype2" value="0x4" /> subtype ?
<Offset name="material_sectype3" value="0x8" /> index of material (for example, 2 is for silver)
<Offset name="material_flags" value="0x18" /> set only for shell / bone mood requirements ?
<Offset name="maintype" value="0x0" /> like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ...
<Offset name="sectype1" value="0x2" /> subsubtype ?
<Offset name="sectype2" value="0x4" /> subtype ?
<Offset name="sectype3" value="0x8" /> index of material (for example, 2 is for silver)
<Offset name="flags" value="0x18" /> set only for shell / bone mood requirements ?
</Group>
</Group>
-->
@ -1764,6 +1650,8 @@
<Offset name="extract_vector" value="0x18f4" />
<Offset name="tile" value="0x20" />
<Offset name="tile_color" value="0x36" />
<!--
!!!! BOGUS !!!!
<Group name="caste">
<Offset name="bodypart_vector" value="0x51C" />
<Offset name="attributes" value="0x654" />
@ -1781,6 +1669,7 @@
<Offset name="singular_vector" value="0x78" />
<Offset name="plural_vector" value="0x90" />
</Group>
-->
</Group>
<Group name="descriptors">
<!--<Address name="vectors_start" value="" />--><!-- search: vector of object with first object having string "STAR" as first member -->
@ -1863,9 +1752,85 @@
<Version name="v0.31.12 linux" os="linux" base="v0.31.11 linux" rebase="-0x1000">
<MD5 value="e79cead03187ecb692961b316b7cdcd4" />
<Offsets>
<Group name="GUI">
<!-- FIXME: this could be wrong for many other versions. Investigate. -->
<Address name="pause_state" value="0x92ec65c"/>
</Group>
<Group name="Constructions">
<Address name="vector" value="0x92f30a4"/>
<Offset name="sizeof" value="0x14"/>
</Group>
<Group name="Position">
<Address name="screen_tiles_pointer" value="0x09487970" />
</Group>
<Group name="Vegetation">
<Address name="vector" value="0x9307568" />
<Offset name="tree_desc_offset" value="0x3C" />
</Group>
<Group name="World">
<Address name="current_weather" value="0x92ec5aa" />
</Group>
</Offsets>
</Version>
<Version name="v0.31.13 linux" os="linux" base="v0.31.12 linux" rebase="-0xB7A8">
<MD5 value="d6307bd39b6271ba89bbdd953d27c84d" />
<Offsets>
<Group name="Buildings">
<Address name="buildings_vector" value="0x92fb8e8" />
</Group>
<Group name="Constructions">
<Address name="vector" value="0x92e7904" />
</Group>
<Group name="Creatures">
<Address name="current_civ" value="0x92e2d9c" />
<Address name="current_race" value="0x92e2da8" />
<Address name="vector" value="0x92fb260" />
</Group>
<Group name="Maps">
<Address name="map_data" value="0x933a4E0" />
<Address name="x_count_block" value="0x933a4F4" />
<Address name="y_count_block" value="0x933a4F8" />
<Address name="z_count_block" value="0x933a4FC" />
<Address name="x_count" value="0x933a500" />
<Address name="y_count" value="0x933a504" />
<Address name="z_count" value="0x933a508" />
<Address name="region_x" value="0x933a50C" />
<Address name="region_y" value="0x933a510" />
<Address name="region_z" value="0x933a514" />
<Address name="world_size_x" value="0x933BB60" />
<Address name="world_size_y" value="0x933BB62" />
<Group name="features">
<Group name="global">
<Address name="vector" value="0x933C0FC" />
</Group>
<Group name="local">
<Address name="start_ptr" value="0x933C174" />
</Group>
</Group>
<Group name="geology">
<Address name="geoblock_vector" value="0x933C114" />
<Address name="ptr2_region_array" value="0x933C138" />
</Group>
</Group>
<Group name="Position">
<Address name="window_x" value="0x8ceb238" />
<Address name="window_y" value="0x8ceb23C" />
<Address name="window_z" value="0x8ceb240" />
<Address name="cursor_xyz" value="0x8b2e740" />
<Address name="window_dims" value="0x8b2ec48" />
<Address name="screen_tiles_pointer" invalid = "true" />
</Group>
<Group name="GUI">
<Address name="pause_state" value="0x92e0e90"/>
</Group>
<Group name="Vegetation">
<Address name="vector" value="0x92fbdc8" />
</Group>
<Group name="World">
<Address name="current_year" value="0x92e0da0" />
<Address name="current_tick" value="0x92e0dc0" />
<Address name="current_weather" value="0x092E0D84" />
</Group>
</Offsets>
</Version>
</DFHack>

@ -26,20 +26,29 @@ include_directories (${CMAKE_SOURCE_DIR}/library/depends/tinyxml/)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/argstream/)
include_directories (${CMAKE_SOURCE_DIR}/library/private/)
SET(PROJECT_HDRS_INTERNAL
private/ContextShared.h
private/Internal.h
)
SET(PROJECT_HDRS
private/ContextShared.h
private/Internal.h
include/DFHack.h
include/dfhack/DFContext.h
include/dfhack/DFContextManager.h
include/dfhack/DFError.h
include/dfhack/VersionInfoFactory.h
include/dfhack/VersionInfo.h
include/dfhack/DFProcessEnumerator.h
include/dfhack/DFExport.h
include/dfhack/DFGlobal.h
include/dfhack/DFIntegers.h
include/dfhack/DFMiscUtils.h
include/dfhack/DFModule.h
include/dfhack/DFPragma.h
include/dfhack/DFProcess.h
include/dfhack/DFProcessEnumerator.h
include/dfhack/DFTileTypes.h
include/dfhack/DFTypes.h
include/dfhack/DFVector.h
include/dfhack-c/DFTypes_C.h
include/dfhack-c/DFContext_C.h
include/dfhack/DFIntegers.h
include/dfhack/VersionInfoFactory.h
include/dfhack/VersionInfo.h
include/dfhack/modules/Buildings.h
include/dfhack/modules/Constructions.h
include/dfhack/modules/Creatures.h
@ -55,8 +64,21 @@ include/dfhack/modules/World.h
)
SET(PROJECT_C_HDRS
include/DFHack_C.h
include/dfhack-c/DFTypes_C.h
include/dfhack-c/DFContext_C.h
include/dfhack-c/modules/Buildings_C.h
include/dfhack-c/modules/Constructions_C.h
include/dfhack-c/modules/Creatures_C.h
include/dfhack-c/modules/Gui_C.h
include/dfhack-c/modules/Items_C.h
include/dfhack-c/modules/Maps_C.h
include/dfhack-c/modules/Materials_C.h
include/dfhack-c/modules/Position_C.h
include/dfhack-c/modules/Translation_C.h
include/dfhack-c/modules/Vegetation_C.h
include/dfhack-c/modules/WindowIO_C.h
include/dfhack-c/modules/World_C.h
)
SET(PROJECT_SRCS
@ -206,4 +228,5 @@ endif(MSVC)
IF(UNIX)
install(TARGETS dfhack LIBRARY DESTINATION lib)
install(FILES ${CMAKE_SOURCE_DIR}/output/Memory.xml DESTINATION share/dfhack)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/library/include/ DESTINATION include FILES_MATCHING PATTERN "*.h")
ENDIF(UNIX)

@ -40,9 +40,10 @@ DFContextShared::~DFContextShared()
bool DFContextShared::InitReadNames()
{
name_firstname_offset = offset_descriptor->getOffset("name_firstname");
name_nickname_offset = offset_descriptor->getOffset("name_nickname");
name_words_offset = offset_descriptor->getOffset("name_words");
OffsetGroup * OG = offset_descriptor->getGroup("name");
name_firstname_offset = OG->getOffset("first");
name_nickname_offset = OG->getOffset("nick");
name_words_offset = OG->getOffset("second_words");
return true;
}

@ -294,7 +294,7 @@ void VersionInfoFactory::ParseBase (TiXmlElement* entry, VersionInfo* mem)
}
else if (type == "Professions")
{
pElement2nd = entry->FirstChildElement("Profession");
pElement2nd = pElement->FirstChildElement("Profession");
for(;pElement2nd;pElement2nd=pElement2nd->NextSiblingElement("Profession"))
{
const char * id = pElement2nd->Attribute("id");
@ -313,7 +313,7 @@ void VersionInfoFactory::ParseBase (TiXmlElement* entry, VersionInfo* mem)
}
else if (type == "Jobs")
{
pElement2nd = entry->FirstChildElement("Job");
pElement2nd = pElement->FirstChildElement("Job");
for(;pElement2nd;pElement2nd=pElement2nd->NextSiblingElement("Job"))
{
const char * id = pElement2nd->Attribute("id");
@ -331,7 +331,7 @@ void VersionInfoFactory::ParseBase (TiXmlElement* entry, VersionInfo* mem)
}
else if (type == "Skills")
{
pElement2nd = entry->FirstChildElement("Skill");
pElement2nd = pElement->FirstChildElement("Skill");
for(;pElement2nd;pElement2nd=pElement2nd->NextSiblingElement("Skill"))
{
const char * id = pElement2nd->Attribute("id");
@ -349,17 +349,17 @@ void VersionInfoFactory::ParseBase (TiXmlElement* entry, VersionInfo* mem)
}
else if (type == "Traits")
{
pElement2nd = entry->FirstChildElement("Trait");
pElement2nd = pElement->FirstChildElement("Trait");
for(;pElement2nd;pElement2nd=pElement2nd->NextSiblingElement("Trait"))
{
const char * id = pElement2nd->Attribute("id");
const char * name = pElement2nd->Attribute("name");
const char * lvl0 = pElement->Attribute("level_0");
const char * lvl1 = pElement->Attribute("level_1");
const char * lvl2 = pElement->Attribute("level_2");
const char * lvl3 = pElement->Attribute("level_3");
const char * lvl4 = pElement->Attribute("level_4");
const char * lvl5 = pElement->Attribute("level_5");
const char * lvl0 = pElement2nd->Attribute("level_0");
const char * lvl1 = pElement2nd->Attribute("level_1");
const char * lvl2 = pElement2nd->Attribute("level_2");
const char * lvl3 = pElement2nd->Attribute("level_3");
const char * lvl4 = pElement2nd->Attribute("level_4");
const char * lvl5 = pElement2nd->Attribute("level_5");
if(id && name && lvl0 && lvl1 && lvl2 && lvl3 && lvl4 && lvl5)
{
mem->setTrait(id, name, lvl0, lvl1, lvl2, lvl3, lvl4, lvl5);
@ -373,7 +373,7 @@ void VersionInfoFactory::ParseBase (TiXmlElement* entry, VersionInfo* mem)
}
else if (type == "Labors")
{
pElement2nd = entry->FirstChildElement("Labor");
pElement2nd = pElement->FirstChildElement("Labor");
for(;pElement2nd;pElement2nd=pElement2nd->NextSiblingElement("Labor"))
{
const char * id = pElement2nd->Attribute("id");
@ -391,7 +391,7 @@ void VersionInfoFactory::ParseBase (TiXmlElement* entry, VersionInfo* mem)
}
else if (type == "Levels")
{
pElement2nd = entry->FirstChildElement("Level");
pElement2nd = pElement->FirstChildElement("Level");
for(;pElement2nd;pElement2nd=pElement2nd->NextSiblingElement("Level"))
{
const char * id = pElement2nd->Attribute("id");
@ -410,7 +410,7 @@ void VersionInfoFactory::ParseBase (TiXmlElement* entry, VersionInfo* mem)
}
else if (type == "Moods")
{
pElement2nd = entry->FirstChildElement("Mood");
pElement2nd = pElement->FirstChildElement("Mood");
for(;pElement2nd;pElement2nd=pElement2nd->NextSiblingElement("Mood"))
{
const char * id = pElement2nd->Attribute("id");

@ -32,6 +32,7 @@
#include "dfhack/modules/Items.h"
#include "dfhack/modules/Vegetation.h"
#include "dfhack/modules/Maps.h"
#include "dfhack/modules/Gui.h"
/*
* This is a header full of ugly, volatile things.

@ -40,6 +40,9 @@ DFHACK_EXPORT int World_ReadCurrentYear(DFHackObject* world, uint32_t* year);
DFHACK_EXPORT int World_ReadCurrentMonth(DFHackObject* world, uint32_t* month);
DFHACK_EXPORT int World_ReadCurrentDay(DFHackObject* world, uint32_t* day);
DFHACK_EXPORT int World_ReadCurrentWeather(DFHackObject* world, uint8_t* weather);
DFHACK_EXPORT int World_WriteCurrentWeather(DFHackObject* world, uint8_t weather);
#ifdef __cplusplus
}
#endif

@ -34,7 +34,12 @@ namespace DFHack
{
namespace Error
{
class DFHACK_EXPORT NoProcess : public std::exception
/*
* our wrapper for the C++ exception. used to differentiate
* the whole array of DFHack exceptions from the rest
*/
class DFHACK_EXPORT All : public std::exception{};
class DFHACK_EXPORT NoProcess : public All
{
public:
virtual const char* what() const throw()
@ -43,7 +48,7 @@ namespace DFHack
}
};
class DFHACK_EXPORT CantAttach : public std::exception
class DFHACK_EXPORT CantAttach : public All
{
public:
virtual const char* what() const throw()
@ -52,7 +57,7 @@ namespace DFHack
}
};
class DFHACK_EXPORT NoMapLoaded : public std::exception
class DFHACK_EXPORT NoMapLoaded : public All
{
public:
virtual const char* what() const throw()
@ -61,7 +66,7 @@ namespace DFHack
}
};
class DFHACK_EXPORT BadMapDimensions : public std::exception
class DFHACK_EXPORT BadMapDimensions : public All
{
public:
BadMapDimensions(uint32_t& _x, uint32_t& _y) : x(_x), y(_y) {}
@ -75,7 +80,7 @@ namespace DFHack
};
// a call to DFHack::mem_info::get* failed
class DFHACK_EXPORT MissingMemoryDefinition : public std::exception
class DFHACK_EXPORT MissingMemoryDefinition : public All
{
public:
MissingMemoryDefinition(const char* _type, const std::string _key) : type(_type), key(_key)
@ -108,7 +113,7 @@ namespace DFHack
};
// a call to DFHack::mem_info::get* failed
class DFHACK_EXPORT UnsetMemoryDefinition : public std::exception
class DFHACK_EXPORT UnsetMemoryDefinition : public All
{
public:
UnsetMemoryDefinition(const char* _type, const std::string _key) : type(_type), key(_key)
@ -141,7 +146,7 @@ namespace DFHack
};
// Syntax errors and whatnot, the xml cant be read
class DFHACK_EXPORT MemoryXmlParse : public std::exception
class DFHACK_EXPORT MemoryXmlParse : public All
{
public:
MemoryXmlParse(const char* _desc, int _id, int _row, int _col)
@ -167,7 +172,7 @@ namespace DFHack
}
};
class DFHACK_EXPORT MemoryXmlBadAttribute : public std::exception
class DFHACK_EXPORT MemoryXmlBadAttribute : public All
{
public:
MemoryXmlBadAttribute(const char* _attr) : attr(_attr)
@ -187,7 +192,7 @@ namespace DFHack
}
};
class DFHACK_EXPORT MemoryXmlNoRoot : public std::exception
class DFHACK_EXPORT MemoryXmlNoRoot : public All
{
public:
MemoryXmlNoRoot() {}
@ -200,7 +205,7 @@ namespace DFHack
}
};
class DFHACK_EXPORT MemoryXmlNoDFExtractor : public std::exception
class DFHACK_EXPORT MemoryXmlNoDFExtractor : public All
{
public:
MemoryXmlNoDFExtractor(const char* _name) : name(_name)
@ -220,7 +225,7 @@ namespace DFHack
}
};
class DFHACK_EXPORT MemoryXmlUnderspecifiedEntry : public std::exception
class DFHACK_EXPORT MemoryXmlUnderspecifiedEntry : public All
{
public:
MemoryXmlUnderspecifiedEntry(const char * _where) : where(_where)
@ -238,7 +243,7 @@ namespace DFHack
}
};
class DFHACK_EXPORT MemoryXmlUnknownType : public std::exception
class DFHACK_EXPORT MemoryXmlUnknownType : public All
{
public:
MemoryXmlUnknownType(const char* _type) : type(_type)
@ -258,7 +263,7 @@ namespace DFHack
}
};
class DFHACK_EXPORT SHMServerDisappeared : public std::exception
class DFHACK_EXPORT SHMServerDisappeared : public All
{
public:
SHMServerDisappeared(){}
@ -268,7 +273,7 @@ namespace DFHack
return "The server process has disappeared";
}
};
class DFHACK_EXPORT SHMLockingError : public std::exception
class DFHACK_EXPORT SHMLockingError : public All
{
public:
SHMLockingError(const char* _type) : type(_type)
@ -287,7 +292,7 @@ namespace DFHack
return full.c_str();
}
};
class DFHACK_EXPORT MemoryAccessDenied : public std::exception
class DFHACK_EXPORT MemoryAccessDenied : public All
{
public:
MemoryAccessDenied() {}
@ -297,7 +302,7 @@ namespace DFHack
return "SHM ACCESS DENIED";
}
};
class DFHACK_EXPORT SHMVersionMismatch : public std::exception
class DFHACK_EXPORT SHMVersionMismatch : public All
{
public:
SHMVersionMismatch() {}
@ -307,7 +312,7 @@ namespace DFHack
return "SHM VERSION MISMATCH";
}
};
class DFHACK_EXPORT SHMAttachFailure : public std::exception
class DFHACK_EXPORT SHMAttachFailure : public All
{
public:
SHMAttachFailure() {}
@ -317,7 +322,7 @@ namespace DFHack
return "SHM ATTACH FAILURE";
}
};
class DFHACK_EXPORT ModuleNotInitialized : public std::exception
class DFHACK_EXPORT ModuleNotInitialized : public All
{
public:
ModuleNotInitialized() {}

@ -21,7 +21,9 @@ namespace DFHack
bool Finish();
///true if paused, false if not
bool ReadPauseState();
bool ReadPauseState();
///true if paused, false if not
void SetPauseState(bool paused);
/// read the DF menu view state (stock screen, unit screen, other screens
bool ReadViewScreen(t_viewscreen &);
/// read the DF menu state (designation menu ect)

@ -9,21 +9,29 @@
namespace DFHack
{
enum WeatherType
{
CLEAR,
RAINING,
SNOWING
};
class DFContextShared;
class DFHACK_EXPORT World : public Module
{
public:
World(DFHack::DFContextShared * d);
~World();
bool Start();
bool Finish();
uint32_t ReadCurrentTick();
uint32_t ReadCurrentYear();
uint32_t ReadCurrentMonth();
uint32_t ReadCurrentDay();
uint8_t ReadCurrentWeather();
void SetCurrentWeather(uint8_t weather);
private:
struct Private;
Private *d;

@ -50,10 +50,16 @@ struct Creatures::Private
{
bool Inited;
bool Started;
bool Ft_basic;
bool Ft_advanced;
bool Ft_jobs;
bool Ft_soul;
Creatures2010::creature_offsets creatures;
uint32_t creature_module;
uint32_t dwarf_race_index_addr;
uint32_t dwarf_civ_id_addr;
OffsetGroup * OG_jobs;
OffsetGroup * OG_job_mats;
DfVector <uint32_t> *p_cre;
DFContextShared *d;
Process *owner;
@ -67,80 +73,72 @@ Creatures::Creatures(DFContextShared* _d)
d->Inited = false;
d->Started = false;
d->d->InitReadNames(); // throws on error
VersionInfo * minfo = d->d->offset_descriptor;
OffsetGroup *OG_Creatures = minfo->getGroup("Creatures");
OffsetGroup *OG_creature = OG_Creatures->getGroup("creature");
OffsetGroup *OG_creature_ex = OG_creature->getGroup("advanced");
OffsetGroup *OG_soul = OG_Creatures->getGroup("soul");
OffsetGroup * OG_name = minfo->getGroup("name");
d->OG_jobs = OG_Creatures->getGroup("job");
d->OG_job_mats = d->OG_jobs->getGroup("material");
d->Ft_basic = d->Ft_advanced = d->Ft_jobs = d->Ft_soul = false;
Creatures2010::creature_offsets &creatures = d->creatures;
try
{
VersionInfo * minfo = d->d->offset_descriptor;
Creatures2010::creature_offsets &creatures = d->creatures;
OffsetGroup *OG_Creatures = minfo->getGroup("Creatures");
{
creatures.vector = OG_Creatures->getAddress ("vector");
d->dwarf_race_index_addr = OG_Creatures->getAddress("current_race");
d->dwarf_civ_id_addr = OG_Creatures->getAddress("current_civ");
OffsetGroup *OG_creature = OG_Creatures->getGroup("creature");
{
creatures.name_offset = OG_creature->getOffset ("name");
creatures.custom_profession_offset = OG_creature->getOffset ("custom_profession");
creatures.profession_offset = OG_creature->getOffset ("profession");
creatures.race_offset = OG_creature->getOffset ("race");
creatures.pos_offset = OG_creature->getOffset ("position");
creatures.flags1_offset = OG_creature->getOffset ("creature_flags1");
creatures.flags2_offset = OG_creature->getOffset ("creature_flags2");
creatures.sex_offset = OG_creature->getOffset ("sex");
creatures.caste_offset = OG_creature->getOffset ("caste");
creatures.id_offset = OG_creature->getOffset ("id");
creatures.civ_offset = OG_creature->getOffset ("civ");
OffsetGroup *OG_creature_ex = OG_creature->getGroup("advanced");
{
creatures.inventory_offset = OG_creature_ex->getOffset("inventory_vector");
creatures.pickup_equipment_bit = OG_creature_ex->getOffset("pickup_equipment_bit");
creatures.mood_offset = OG_creature_ex->getOffset("mood");
// pregnancy
// pregnancy_ptr
creatures.birth_year_offset = OG_creature_ex->getOffset("birth_year");
creatures.birth_time_offset = OG_creature_ex->getOffset("birth_time");
creatures.current_job_offset = OG_creature_ex->getOffset("current_job");
creatures.mood_skill_offset = OG_creature_ex->getOffset("current_job_skill");
creatures.physical_offset = OG_creature_ex->getOffset("physical");
creatures.appearance_vector_offset = OG_creature_ex->getOffset("appearance_vector");
creatures.artifact_name_offset = OG_creature_ex->getOffset("artifact_name");
creatures.soul_vector_offset = OG_creature_ex->getOffset("soul_vector");
creatures.default_soul_offset = OG_creature_ex->getOffset("current_soul");
creatures.labors_offset = OG_creature_ex->getOffset ("labors");
creatures.happiness_offset = OG_creature_ex->getOffset ("happiness");
}
}
OffsetGroup *OG_soul = OG_Creatures->getGroup("soul");
{
creatures.soul_mental_offset = OG_soul->getOffset("mental");
creatures.soul_skills_vector_offset = OG_soul->getOffset("skills_vector");
creatures.soul_traits_offset = OG_soul->getOffset("traits");
}
}
// name offsets for the creature module
OffsetGroup * OG_name = minfo->getGroup("name");
// Creatures
creatures.vector = OG_Creatures->getAddress ("vector");
d->dwarf_race_index_addr = OG_Creatures->getAddress("current_race");
d->dwarf_civ_id_addr = OG_Creatures->getAddress("current_civ");
// Creatures/creature
creatures.name_offset = OG_creature->getOffset ("name");
creatures.custom_profession_offset = OG_creature->getOffset ("custom_profession");
creatures.profession_offset = OG_creature->getOffset ("profession");
creatures.race_offset = OG_creature->getOffset ("race");
creatures.pos_offset = OG_creature->getOffset ("position");
creatures.flags1_offset = OG_creature->getOffset ("flags1");
creatures.flags2_offset = OG_creature->getOffset ("flags2");
creatures.sex_offset = OG_creature->getOffset ("sex");
creatures.caste_offset = OG_creature->getOffset ("caste");
creatures.id_offset = OG_creature->getOffset ("id");
creatures.civ_offset = OG_creature->getOffset ("civ");
// name struct
creatures.name_firstname_offset = OG_name->getOffset("first");
creatures.name_nickname_offset = OG_name->getOffset("nick");
creatures.name_words_offset = OG_name->getOffset("second_words");
d->Ft_basic = true;
try
{
creatures.name_firstname_offset = OG_name->getOffset("first");
creatures.name_nickname_offset = OG_name->getOffset("nick");
creatures.name_words_offset = OG_name->getOffset("second_words");
creatures.inventory_offset = OG_creature_ex->getOffset("inventory_vector");
creatures.pickup_equipment_bit = OG_creature_ex->getOffset("pickup_equipment_bit");
creatures.mood_offset = OG_creature_ex->getOffset("mood");
// pregnancy
// pregnancy_ptr
creatures.birth_year_offset = OG_creature_ex->getOffset("birth_year");
creatures.birth_time_offset = OG_creature_ex->getOffset("birth_time");
creatures.current_job_offset = OG_creature_ex->getOffset("current_job");
creatures.mood_skill_offset = OG_creature_ex->getOffset("current_job_skill");
creatures.physical_offset = OG_creature_ex->getOffset("physical");
creatures.appearance_vector_offset = OG_creature_ex->getOffset("appearance_vector");
creatures.artifact_name_offset = OG_creature_ex->getOffset("artifact_name");
creatures.labors_offset = OG_creature_ex->getOffset ("labors");
creatures.happiness_offset = OG_creature_ex->getOffset ("happiness");
d->Ft_advanced = true;
}
/*
// upload offsets to the SHM
if(p->getModuleIndex("Creatures2010",1,d->creature_module))
catch(Error::All&){};
try
{
// supply the module with offsets so it can work with them
memcpy(SHMDATA(Creatures2010::creature_offsets),&creatures,sizeof(Creatures2010::creature_offsets));
const uint32_t cmd = Creatures2010::CREATURE_INIT + (d->creature_module << 16);
p->SetAndWait(cmd);
creatures.soul_vector_offset = OG_creature_ex->getOffset("soul_vector");
creatures.default_soul_offset = OG_creature_ex->getOffset("current_soul");
creatures.soul_mental_offset = OG_soul->getOffset("mental");
creatures.soul_skills_vector_offset = OG_soul->getOffset("skills_vector");
creatures.soul_traits_offset = OG_soul->getOffset("traits");
d->Ft_soul = true;
}
*/
d->Inited = true;
}
catch (Error::MissingMemoryDefinition&)
{
d->Inited = false;
throw;
catch(Error::All&){};
}
catch(Error::All&){};
d->Inited = true;
}
Creatures::~Creatures()
@ -171,6 +169,7 @@ bool Creatures::Finish()
bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
{
if(!d->Started) return false;
memset(&furball, 0, sizeof(t_creature));
// SHM fast path
Process * p = d->owner;
/*
@ -192,129 +191,120 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
Creatures2010::creature_offsets &offs = d->creatures;
//read creature from memory
// name
d->d->readName(furball.name,temp + offs.name_offset);
// basic stuff
p->readDWord (temp + offs.happiness_offset, furball.happiness);
p->readDWord (temp + offs.id_offset, furball.id);
p->read (temp + offs.pos_offset, 3 * sizeof (uint16_t), (uint8_t *) & (furball.x)); // xyz really
p->readDWord (temp + offs.race_offset, furball.race);
furball.civ = p->readDWord (temp + offs.civ_offset);
p->readByte (temp + offs.sex_offset, furball.sex);
p->readWord (temp + offs.caste_offset, furball.caste);
p->readDWord (temp + offs.flags1_offset, furball.flags1.whole);
p->readDWord (temp + offs.flags2_offset, furball.flags2.whole);
// physical attributes
p->read(temp + offs.physical_offset,
sizeof(t_attrib) * NUM_CREATURE_PHYSICAL_ATTRIBUTES,
(uint8_t *)&furball.strength);
// mood stuff
furball.mood = (int16_t) p->readWord (temp + offs.mood_offset);
furball.mood_skill = p->readWord (temp + offs.mood_skill_offset);
d->d->readName(furball.artifact_name, temp + offs.artifact_name_offset);
// custom profession
p->readSTLString(temp + offs.custom_profession_offset, furball.custom_profession, sizeof(furball.custom_profession));
//fill_char_buf (furball.custom_profession, p->readSTLString (temp + offs.custom_profession_offset));
// labors
p->read (temp + offs.labors_offset, NUM_CREATURE_LABORS, furball.labors);
// profession
furball.profession = p->readByte (temp + offs.profession_offset);
furball.current_job.occupationPtr = p->readDWord (temp + offs.current_job_offset);
if(furball.current_job.occupationPtr)
if(d->Ft_basic)
{
furball.current_job.active = true;
furball.current_job.jobType = p->readByte (furball.current_job.occupationPtr + minfo->getOffset("job_type") );
furball.current_job.jobId = p->readDWord (furball.current_job.occupationPtr + minfo->getOffset("job_id") );
// name
d->d->readName(furball.name,temp + offs.name_offset);
// basic stuff
p->readDWord (temp + offs.id_offset, furball.id);
p->read (temp + offs.pos_offset, 3 * sizeof (uint16_t), (uint8_t *) & (furball.x)); // xyz really
p->readDWord (temp + offs.race_offset, furball.race);
furball.civ = p->readDWord (temp + offs.civ_offset);
p->readByte (temp + offs.sex_offset, furball.sex);
p->readWord (temp + offs.caste_offset, furball.caste);
p->readDWord (temp + offs.flags1_offset, furball.flags1.whole);
p->readDWord (temp + offs.flags2_offset, furball.flags2.whole);
// custom profession
p->readSTLString(temp + offs.custom_profession_offset, furball.custom_profession, sizeof(furball.custom_profession));
// profession
furball.profession = p->readByte (temp + offs.profession_offset);
}
else
if(d->Ft_advanced)
{
furball.current_job.active = false;;
}
furball.birth_year = p->readDWord (temp + offs.birth_year_offset );
furball.birth_time = p->readDWord (temp + offs.birth_time_offset );
// current job HACK: the job object isn't cleanly represented here
/*
uint32_t jobIdAddr = p->readDWord (temp + offs.creature_current_job_offset);
// happiness
p->readDWord (temp + offs.happiness_offset, furball.happiness);
// physical attributes
p->read(temp + offs.physical_offset,
sizeof(t_attrib) * NUM_CREATURE_PHYSICAL_ATTRIBUTES,
(uint8_t *)&furball.strength);
// mood stuff
furball.mood = (int16_t) p->readWord (temp + offs.mood_offset);
furball.mood_skill = p->readWord (temp + offs.mood_skill_offset);
d->d->readName(furball.artifact_name, temp + offs.artifact_name_offset);
// labors
p->read (temp + offs.labors_offset, NUM_CREATURE_LABORS, furball.labors);
furball.birth_year = p->readDWord (temp + offs.birth_year_offset );
furball.birth_time = p->readDWord (temp + offs.birth_time_offset );
/*
* p->readDWord(temp + offs.creature_pregnancy_offset, furball.pregnancy_timer);
*/
// appearance
DfVector <uint32_t> app(p, temp + offs.appearance_vector_offset);
furball.nbcolors = app.size();
if(furball.nbcolors>MAX_COLORS)
furball.nbcolors = MAX_COLORS;
for(uint32_t i = 0; i < furball.nbcolors; i++)
{
furball.color[i] = app[i];
}
if (jobIdAddr)
{
furball.current_job.active = true;
furball.current_job.jobId = p->readByte (jobIdAddr + offs.creature_current_job_id_offset);
//likes
/*
DfVector <uint32_t> likes(d->p, temp + offs.creature_likes_offset);
furball.numLikes = likes.getSize();
for(uint32_t i = 0;i<furball.numLikes;i++)
{
uint32_t temp2 = *(uint32_t *) likes[i];
p->read(temp2,sizeof(t_like),(uint8_t *) &furball.likes[i]);
}*/
}
else
if(d->Ft_soul)
{
furball.current_job.active = false;
}
*/
/*
// enum soul pointer vector
DfVector <uint32_t> souls(p,temp + offs.creature_soul_vector_offset);
*/
uint32_t soul = p->readDWord(temp + offs.default_soul_offset);
furball.has_default_soul = false;
/*
p->readDWord(temp + offs.creature_pregnancy_offset, furball.pregnancy_timer);
*/
if(soul)
{
furball.has_default_soul = true;
// get first soul's skills
DfVector <uint32_t> skills(p, soul + offs.soul_skills_vector_offset);
furball.defaultSoul.numSkills = skills.size();
/*
// enum soul pointer vector
DfVector <uint32_t> souls(p,temp + offs.creature_soul_vector_offset);
*/
uint32_t soul = p->readDWord(temp + offs.default_soul_offset);
furball.has_default_soul = false;
for (uint32_t i = 0; i < furball.defaultSoul.numSkills;i++)
{
uint32_t temp2 = skills[i];
// a byte: this gives us 256 skills maximum.
furball.defaultSoul.skills[i].id = p->readByte (temp2);
furball.defaultSoul.skills[i].rating =
p->readByte (temp2 + offsetof(t_skill, rating));
furball.defaultSoul.skills[i].experience =
p->readWord (temp2 + offsetof(t_skill, experience));
}
if(soul)
{
furball.has_default_soul = true;
// get first soul's skills
DfVector <uint32_t> skills(p, soul + offs.soul_skills_vector_offset);
furball.defaultSoul.numSkills = skills.size();
// mental attributes are part of the soul
p->read(soul + offs.soul_mental_offset,
sizeof(t_attrib) * NUM_CREATURE_MENTAL_ATTRIBUTES,
(uint8_t *)&furball.defaultSoul.analytical_ability);
for (uint32_t i = 0; i < furball.defaultSoul.numSkills;i++)
{
uint32_t temp2 = skills[i];
// a byte: this gives us 256 skills maximum.
furball.defaultSoul.skills[i].id = p->readByte (temp2);
furball.defaultSoul.skills[i].rating =
p->readByte (temp2 + offsetof(t_skill, rating));
furball.defaultSoul.skills[i].experience =
p->readWord (temp2 + offsetof(t_skill, experience));
// traits as well
p->read(soul + offs.soul_traits_offset,
sizeof (uint16_t) * NUM_CREATURE_TRAITS,
(uint8_t *) &furball.defaultSoul.traits);
}
// mental attributes are part of the soul
p->read(soul + offs.soul_mental_offset,
sizeof(t_attrib) * NUM_CREATURE_MENTAL_ATTRIBUTES,
(uint8_t *)&furball.defaultSoul.analytical_ability);
// traits as well
p->read(soul + offs.soul_traits_offset,
sizeof (uint16_t) * NUM_CREATURE_TRAITS,
(uint8_t *) &furball.defaultSoul.traits);
}
DfVector <uint32_t> app(p, temp + offs.appearance_vector_offset);
furball.nbcolors = app.size();
if(furball.nbcolors>MAX_COLORS)
furball.nbcolors = MAX_COLORS;
for(uint32_t i = 0; i < furball.nbcolors; i++)
if(d->Ft_jobs)
{
furball.color[i] = app[i];
furball.current_job.occupationPtr = p->readDWord (temp + offs.current_job_offset);
if(furball.current_job.occupationPtr)
{
furball.current_job.active = true;
furball.current_job.jobType = p->readByte (furball.current_job.occupationPtr + d->OG_jobs->getOffset("type") );
furball.current_job.jobId = p->readDWord (furball.current_job.occupationPtr + d->OG_jobs->getOffset("id") );
}
else
{
furball.current_job.active = false;;
}
}
//likes
/*
DfVector <uint32_t> likes(d->p, temp + offs.creature_likes_offset);
furball.numLikes = likes.getSize();
for(uint32_t i = 0;i<furball.numLikes;i++)
{
uint32_t temp2 = *(uint32_t *) likes[i];
p->read(temp2,sizeof(t_like),(uint8_t *) &furball.likes[i]);
}*/
return true;
}
@ -534,21 +524,19 @@ bool Creatures::WriteMoodSkill(const uint32_t index, const uint16_t moodSkill)
bool Creatures::WriteJob(const t_creature * furball, std::vector<t_material> const& mat)
{
unsigned int i;
unsigned int i;
if(!d->Inited) return false;
if(!furball->current_job.active) return false;
Process * p = d->owner;
VersionInfo * minfo = d->d->offset_descriptor;
DfVector <uint32_t> cmats(p, furball->current_job.occupationPtr + minfo->getOffset("job_materials_vector"));
DfVector <uint32_t> cmats(p, furball->current_job.occupationPtr + d->OG_jobs->getOffset("materials_vector"));
for(i=0;i<cmats.size();i++)
{
p->writeWord(cmats[i] + minfo->getOffset("job_material_maintype"), mat[i].itemType);
p->writeWord(cmats[i] + minfo->getOffset("job_material_sectype1"), mat[i].subType);
p->writeWord(cmats[i] + minfo->getOffset("job_material_sectype2"), mat[i].subIndex);
p->writeDWord(cmats[i] + minfo->getOffset("job_material_sectype3"), mat[i].index);
p->writeDWord(cmats[i] + minfo->getOffset("job_material_flags"), mat[i].flags);
p->writeWord(cmats[i] + d->OG_job_mats->getOffset("maintype"), mat[i].itemType);
p->writeWord(cmats[i] + d->OG_job_mats->getOffset("sectype1"), mat[i].subType);
p->writeWord(cmats[i] + d->OG_job_mats->getOffset("sectype2"), mat[i].subIndex);
p->writeDWord(cmats[i] + d->OG_job_mats->getOffset("sectype3"), mat[i].index);
p->writeDWord(cmats[i] + d->OG_job_mats->getOffset("flags"), mat[i].flags);
}
return true;
}
@ -610,15 +598,15 @@ bool Creatures::ReadJob(const t_creature * furball, vector<t_material> & mat)
Process * p = d->owner;
VersionInfo * minfo = d->d->offset_descriptor;
DfVector <uint32_t> cmats(p, furball->current_job.occupationPtr + minfo->getOffset("job_materials_vector"));
DfVector <uint32_t> cmats(p, furball->current_job.occupationPtr + d->OG_jobs->getOffset("materials_vector"));
mat.resize(cmats.size());
for(i=0;i<cmats.size();i++)
{
mat[i].itemType = p->readWord(cmats[i] + minfo->getOffset("job_material_maintype"));
mat[i].subType = p->readWord(cmats[i] + minfo->getOffset("job_material_sectype1"));
mat[i].subIndex = p->readWord(cmats[i] + minfo->getOffset("job_material_sectype2"));
mat[i].index = p->readDWord(cmats[i] + minfo->getOffset("job_material_sectype3"));
mat[i].flags = p->readDWord(cmats[i] + minfo->getOffset("job_material_flags"));
mat[i].itemType = p->readWord(cmats[i] + d->OG_job_mats->getOffset("maintype"));
mat[i].subType = p->readWord(cmats[i] + d->OG_job_mats->getOffset("sectype1"));
mat[i].subIndex = p->readWord(cmats[i] + d->OG_job_mats->getOffset("sectype2"));
mat[i].index = p->readDWord(cmats[i] + d->OG_job_mats->getOffset("sectype3"));
mat[i].flags = p->readDWord(cmats[i] + d->OG_job_mats->getOffset("flags"));
}
return true;
}

@ -33,12 +33,17 @@ using namespace DFHack;
struct Gui::Private
{
bool Inited;
Private()
{
Started = PauseInited = ViewScreeInited = MenuStateInited = false;
}
bool Started;
uint32_t pause_state_offset;
bool PauseInited;
uint32_t view_screen_offset;
uint32_t current_cursor_creature_offset;
bool ViewScreeInited;
uint32_t current_menu_state_offset;
bool MenuStateInited;
DFContextShared *d;
Process * owner;
};
@ -49,13 +54,26 @@ Gui::Gui(DFContextShared * _d)
d = new Private;
d->d = _d;
d->owner = _d->p;
d->Inited = d->Started = true;
OffsetGroup * OG_Gui = d->d->offset_descriptor->getGroup("Gui");
d->current_menu_state_offset = OG_Gui->getAddress("current_menu_state");
d->pause_state_offset = OG_Gui->getAddress ("pause_state");
d->view_screen_offset = OG_Gui->getAddress ("view_screen");
d->Inited = d->Started = true;
OffsetGroup * OG_Gui = d->d->offset_descriptor->getGroup("GUI");
try
{
d->current_menu_state_offset = OG_Gui->getAddress("current_menu_state");
d->MenuStateInited = true;
}
catch(exception &){};
try
{
d->pause_state_offset = OG_Gui->getAddress ("pause_state");
d->PauseInited = true;
}
catch(exception &){};
try
{
d->view_screen_offset = OG_Gui->getAddress ("view_screen");
d->ViewScreeInited = true;
}
catch(exception &){};
d->Started = true;
}
Gui::~Gui()
@ -75,23 +93,29 @@ bool Gui::Finish()
bool Gui::ReadPauseState()
{
// replace with an exception
if(!d->Inited) return false;
if(!d->PauseInited) return false;
uint32_t pauseState = d->owner->readDWord (d->pause_state_offset);
return pauseState & 1;
}
void Gui::SetPauseState(bool paused)
{
if(!d->PauseInited) return;
cout << "pause set" << endl;
d->owner->writeDWord (d->pause_state_offset, paused);
}
uint32_t Gui::ReadMenuState()
{
if(d->Inited)
if(d->MenuStateInited)
return(d->owner->readDWord(d->current_menu_state_offset));
return false;
}
bool Gui::ReadViewScreen (t_viewscreen &screen)
{
if (!d->Inited) return false;
if (!d->ViewScreeInited) return false;
Process * p = d->owner;
uint32_t last = p->readDWord (d->view_screen_offset);

@ -70,6 +70,7 @@ Maps::Maps(DFContextShared* _d)
d->d = _d;
Process *p = d->owner = _d->p;
d->Inited = d->Started = false;
d->block = NULL;
DFHack::VersionInfo * mem = p->getDescriptor();
Server::Maps::maps_offsets &off = d->offsets;

@ -29,6 +29,7 @@ distribution.
#include "dfhack/VersionInfo.h"
#include "dfhack/DFProcess.h"
#include "dfhack/DFVector.h"
#include <dfhack/DFError.h>
using namespace DFHack;
@ -71,6 +72,7 @@ Materials::~Materials()
bool Materials::Finish()
{
/*
inorganic.clear();
organic.clear();
tree.clear();
@ -80,6 +82,7 @@ bool Materials::Finish()
color.clear();
other.clear();
alldesc.clear();
*/
return true;
}
@ -331,22 +334,40 @@ bool Materials::ReadCreatureTypesEx (void)
OffsetGroup * OG_Creature = OG_Mats->getGroup("creature");
uint32_t castes_vector_offset = OG_Creature->getOffset ("caste_vector");
uint32_t extract_vector_offset = OG_Creature->getOffset ("extract_vector");
uint32_t tile_offset = OG_Creature->getOffset ("creature_tile");
uint32_t tile_color_offset = OG_Creature->getOffset ("creature_tile_color");
uint32_t tile_offset = OG_Creature->getOffset ("tile");
uint32_t tile_color_offset = OG_Creature->getOffset ("tile_color");
bool have_advanced = false;
uint32_t caste_colormod_offset;
uint32_t caste_attributes_offset;
uint32_t caste_bodypart_offset;
uint32_t bodypart_id_offset;
uint32_t bodypart_category_offset;
uint32_t bodypart_layers_offset;
uint32_t bodypart_singular_offset;
uint32_t bodypart_plural_offset;
uint32_t color_modifier_part_offset;
uint32_t color_modifier_startdate_offset;
uint32_t color_modifier_enddate_offset;
try
{
OffsetGroup * OG_Caste = OG_Creature->getGroup("caste");
uint32_t caste_colormod_offset = OG_Caste->getOffset ("color_modifiers");
uint32_t caste_attributes_offset = OG_Caste->getOffset ("attributes");
uint32_t caste_bodypart_offset = OG_Caste->getOffset ("bodypart_vector");
caste_colormod_offset = OG_Caste->getOffset ("color_modifiers");
caste_attributes_offset = OG_Caste->getOffset ("attributes");
caste_bodypart_offset = OG_Caste->getOffset ("bodypart_vector");
OffsetGroup * OG_CasteBodyparts = OG_Creature->getGroup("caste_bodyparts");
uint32_t bodypart_id_offset = OG_CasteBodyparts->getOffset ("id");
uint32_t bodypart_category_offset = OG_CasteBodyparts->getOffset ("category");
uint32_t bodypart_layers_offset = OG_CasteBodyparts->getOffset ("layers_vector"); // unused
uint32_t bodypart_singular_offset = OG_CasteBodyparts->getOffset ("singular_vector"); // unused
uint32_t bodypart_plural_offset = OG_CasteBodyparts->getOffset ("plural_vector"); // unused
bodypart_id_offset = OG_CasteBodyparts->getOffset ("id");
bodypart_category_offset = OG_CasteBodyparts->getOffset ("category");
bodypart_layers_offset = OG_CasteBodyparts->getOffset ("layers_vector"); // unused
bodypart_singular_offset = OG_CasteBodyparts->getOffset ("singular_vector"); // unused
bodypart_plural_offset = OG_CasteBodyparts->getOffset ("plural_vector"); // unused
OffsetGroup * OG_CasteColorMods = OG_Creature->getGroup("caste_color_mods");
uint32_t color_modifier_part_offset = OG_CasteColorMods->getOffset ("part");
uint32_t color_modifier_startdate_offset = OG_CasteColorMods->getOffset ("startdate");
uint32_t color_modifier_enddate_offset = OG_CasteColorMods->getOffset ("enddate");
color_modifier_part_offset = OG_CasteColorMods->getOffset ("part");
color_modifier_startdate_offset = OG_CasteColorMods->getOffset ("startdate");
color_modifier_enddate_offset = OG_CasteColorMods->getOffset ("enddate");
have_advanced = true;
}
catch (Error::All &){};
uint32_t size = p_races.size();
uint32_t sizecas = 0;
@ -381,38 +402,36 @@ bool Materials::ReadCreatureTypesEx (void)
p->readSTLString (caste_start + sizeof_string, caste.singular, sizeof(caste.singular));
p->readSTLString (caste_start + 2 * sizeof_string, caste.plural, sizeof(caste.plural));
p->readSTLString (caste_start + 3 * sizeof_string, caste.adjective, sizeof(caste.adjective));
/* color mod reading */
DfVector <uint32_t> p_colormod(p, caste_start + caste_colormod_offset);
sizecolormod = p_colormod.size();
caste.ColorModifier.resize(sizecolormod);
for(uint32_t k = 0; k < sizecolormod;k++)
{
DfVector <uint32_t> p_colorlist(p, p_colormod[k]);
sizecolorlist = p_colorlist.size();
caste.ColorModifier[k].colorlist.resize(sizecolorlist);
for(uint32_t l = 0; l < sizecolorlist; l++)
caste.ColorModifier[k].colorlist[l] = p_colorlist[l];
p->readSTLString( p_colormod[k] + color_modifier_part_offset, caste.ColorModifier[k].part, sizeof(caste.ColorModifier[k].part));
caste.ColorModifier[k].startdate = p->readDWord( p_colormod[k] + color_modifier_startdate_offset );
caste.ColorModifier[k].enddate = p->readDWord( p_colormod[k] + color_modifier_enddate_offset );
}
/* body parts */
DfVector <uint32_t> p_bodypart(p, caste_start + caste_bodypart_offset);
caste.bodypart.empty();
sizebp = p_bodypart.size();
for(uint32_t k = 0; k < sizebp; k++)
if(have_advanced)
{
t_bodypart part;
p->readSTLString (p_bodypart[k] + bodypart_id_offset, part.id, sizeof(part.id));
p->readSTLString (p_bodypart[k] + bodypart_category_offset, part.category, sizeof(part.category));
caste.bodypart.push_back(part);
/* color mod reading */
DfVector <uint32_t> p_colormod(p, caste_start + caste_colormod_offset);
sizecolormod = p_colormod.size();
caste.ColorModifier.resize(sizecolormod);
for(uint32_t k = 0; k < sizecolormod;k++)
{
DfVector <uint32_t> p_colorlist(p, p_colormod[k]);
sizecolorlist = p_colorlist.size();
caste.ColorModifier[k].colorlist.resize(sizecolorlist);
for(uint32_t l = 0; l < sizecolorlist; l++)
caste.ColorModifier[k].colorlist[l] = p_colorlist[l];
p->readSTLString( p_colormod[k] + color_modifier_part_offset, caste.ColorModifier[k].part, sizeof(caste.ColorModifier[k].part));
caste.ColorModifier[k].startdate = p->readDWord( p_colormod[k] + color_modifier_startdate_offset );
caste.ColorModifier[k].enddate = p->readDWord( p_colormod[k] + color_modifier_enddate_offset );
}
/* body parts */
DfVector <uint32_t> p_bodypart(p, caste_start + caste_bodypart_offset);
caste.bodypart.empty();
sizebp = p_bodypart.size();
for(uint32_t k = 0; k < sizebp; k++)
{
t_bodypart part;
p->readSTLString (p_bodypart[k] + bodypart_id_offset, part.id, sizeof(part.id));
p->readSTLString (p_bodypart[k] + bodypart_category_offset, part.category, sizeof(part.category));
caste.bodypart.push_back(part);
}
p->read(caste_start + caste_attributes_offset, sizeof(t_attrib) * (6+11), (uint8_t *)&caste.strength);
}
p->read(caste_start + caste_attributes_offset, sizeof(t_attrib) * (6+11), (uint8_t *)&caste.strength);
mat.castes.push_back(caste);
}
DfVector <uint32_t> p_extract(p, p_races[i] + extract_vector_offset);
@ -436,7 +455,7 @@ void Materials::ReadAllMaterials(void)
this->ReadCreatureTypes();
this->ReadCreatureTypesEx();
this->ReadDescriptorColors();
this->ReadOthers();
//this->ReadOthers();
}
std::string Materials::getDescription(t_material & mat)

@ -27,6 +27,7 @@ distribution.
#include "dfhack/modules/Position.h"
#include "dfhack/VersionInfo.h"
#include "dfhack/DFProcess.h"
#include "dfhack/DFError.h"
using namespace DFHack;
struct Position::Private
@ -71,24 +72,24 @@ Position::Position(DFContextShared * d_)
d->cursor_xyz_offset = OG_Position->getAddress ("cursor_xyz");
d->window_dims_offset = OG_Position->getAddress ("window_dims");
d->Started = true;
try
{
OffsetGroup * OG_Hotkeys = mem->getGroup("Hotkeys");
d->hotkey_start = OG_Hotkeys->getAddress("start");
d->hotkey_mode_offset = OG_Hotkeys->getOffset ("mode");
d->hotkey_xyz_offset = OG_Hotkeys->getOffset("coords");
d->hotkey_size = OG_Hotkeys->getHexValue("size");
d->StartedHotkeys = true;
}
catch(exception &){};
try
{
d->screen_tiles_ptr_offset = OG_Position->getAddress ("screen_tiles_pointer");
d->StartedScreen = true;
}
catch(exception &){};
}
catch(exception &){};
catch(Error::All &){};
try
{
OffsetGroup * OG_Hotkeys = mem->getGroup("Hotkeys");
d->hotkey_start = OG_Hotkeys->getAddress("start");
d->hotkey_mode_offset = OG_Hotkeys->getOffset ("mode");
d->hotkey_xyz_offset = OG_Hotkeys->getOffset("coords");
d->hotkey_size = OG_Hotkeys->getHexValue("size");
d->StartedHotkeys = true;
}
catch(Error::All &){};
try
{
d->screen_tiles_ptr_offset = OG_Position->getAddress ("screen_tiles_pointer");
d->StartedScreen = true;
}
catch(Error::All &){};
}
Position::~Position()

@ -40,15 +40,18 @@ FIXME: Japa said that he had to do this with the time stuff he got from here
#include "dfhack/DFProcess.h"
#include "dfhack/VersionInfo.h"
#include "dfhack/DFTypes.h"
#include "dfhack/DFError.h"
using namespace DFHack;
struct World::Private
{
bool Inited;
bool Started;
bool StartedTime;
bool StartedWeather;
uint32_t year_offset;
uint32_t tick_offset;
uint32_t weather_offset;
DFContextShared *d;
Process * owner;
};
@ -59,11 +62,23 @@ World::World(DFContextShared * _d)
d = new Private;
d->d = _d;
d->owner = _d->p;
d->Inited = d->StartedTime = d->StartedWeather = false;
OffsetGroup * OG_World = d->d->offset_descriptor->getGroup("World");
d->year_offset = OG_World->getAddress( "current_year" );
d->tick_offset = OG_World->getAddress( "current_tick" );
d->Inited = d->Started = true;
try
{
d->year_offset = OG_World->getAddress( "current_year" );
d->tick_offset = OG_World->getAddress( "current_tick" );
d->StartedTime = true;
}
catch(Error::All &){};
try
{
d->weather_offset = OG_World->getAddress( "current_weather" );
d->StartedWeather = true;
}
catch(Error::All &){};
d->Inited = true;
}
World::~World()
@ -83,14 +98,14 @@ bool World::Finish()
uint32_t World::ReadCurrentYear()
{
if(d->Inited)
if(d->Inited && d->StartedTime)
return(d->owner->readDWord(d->year_offset));
return 0;
}
uint32_t World::ReadCurrentTick()
{
if(d->Inited)
if(d->Inited && d->StartedTime)
return(d->owner->readDWord(d->tick_offset));
return 0;
}
@ -114,3 +129,26 @@ uint32_t World::ReadCurrentDay()
{
return ((this->ReadCurrentTick() / 1200) % 28) + 1;
}
uint8_t World::ReadCurrentWeather()
{
if (d->Inited && d->StartedWeather)
return(d->owner->readByte(d->weather_offset + 12));
return 0;
}
/*
void World::SetCurrentWeather(uint8_t weather)
{
if (d->Inited && d->StartedWeather)
d->owner->writeByte(d->weather_offset,weather);
}
*/
void World::SetCurrentWeather(uint8_t weather)
{
if (d->Inited && d->StartedWeather)
{
uint8_t buf[25];
memset(&buf,weather, sizeof(buf));
d->owner->write(d->weather_offset,sizeof(buf),buf);
}
}

@ -39,7 +39,7 @@ int World_Start(DFHackObject* world)
else
return 0;
}
return -1;
}
@ -52,7 +52,7 @@ int World_Finish(DFHackObject* world)
else
return 0;
}
return -1;
}
@ -63,7 +63,7 @@ int World_ReadCurrentTick(DFHackObject* world, uint32_t* tick)
*tick = ((DFHack::World*)world)->ReadCurrentTick();
return 1;
}
return -1;
}
@ -74,7 +74,7 @@ int World_ReadCurrentYear(DFHackObject* world, uint32_t* year)
*year = ((DFHack::World*)world)->ReadCurrentYear();
return 1;
}
return -1;
}
@ -85,7 +85,7 @@ int World_ReadCurrentMonth(DFHackObject* world, uint32_t* month)
*month = ((DFHack::World*)world)->ReadCurrentMonth();
return 1;
}
return -1;
}
@ -96,10 +96,32 @@ int World_ReadCurrentDay(DFHackObject* world, uint32_t* day)
*day = ((DFHack::World*)world)->ReadCurrentDay();
return 1;
}
return -1;
}
int World_ReadCurrentWeather(DFHackObject* world, uint8_t* weather)
{
if(world != NULL)
{
*weather = ((DFHack::World*)world)->ReadCurrentWeather();
return 1;
}
return -1;
}
int World_WriteCurrentWeather(DFHackObject* world, uint8_t weather)
{
if (world != NULL)
{
((DFHack::World*)world)->SetCurrentWeather(weather);
return 1;
}
return -1;
}
#ifdef __cplusplus
}
#endif

@ -134,7 +134,7 @@ likeType printLike40d(DFHack::t_like like, const matGlosses & mat,const vector<
void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
{
uint32_t dayoflife;
cout << "address: " << hex << creature.origin << dec << " creature type: " << Materials->raceEx[creature.race].rawname
cout << "address: " << hex << creature.origin << dec << ", creature race: " << creature.race << "/" << Materials->raceEx[creature.race].rawname
<< "[" << Materials->raceEx[creature.race].tile_character
<< "," << Materials->raceEx[creature.race].tilecolor.fore
<< "," << Materials->raceEx[creature.race].tilecolor.back
@ -172,7 +172,7 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
if(creature.civ)
{
cout << "civilization: " << creature.civ;
cout << ", civilization: " << creature.civ;
addendl = true;
}
@ -191,7 +191,7 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
cout << endl;
addendl = false;
}
cout << "profession: " << mem->getProfession(creature.profession) << "(" << (int) creature.profession << ")";
cout << ", profession: " << mem->getProfession(creature.profession) << "(" << (int) creature.profession << ")";
if(creature.custom_profession[0])
{
@ -271,8 +271,9 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
}
}
std::vector<uint32_t> inventory;
//std::vector<uint32_t> inventory;
// FIXME: TOO BAD...
/*
if( Creatures->ReadInventoryPtr(creature.origin, inventory) )
{
DFHack::Items * Items = DF->getItems();
@ -282,6 +283,7 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
printf("\t\t%s\n", Items->getItemDescription(inventory[i], Materials).c_str());
}
}
*/
/*
if(creature.pregnancy_timer > 0)
@ -451,8 +453,14 @@ int main (int numargs, char ** args)
}
mem = DF->getMemoryInfo();
Materials->ReadAllMaterials();
Materials->ReadInorganicMaterials();
Materials->ReadOrganicMaterials();
Materials->ReadWoodMaterials();
Materials->ReadPlantMaterials();
Materials->ReadCreatureTypes();
Materials->ReadCreatureTypesEx();
Materials->ReadDescriptorColors();
if(!Tran->Start())
{
cerr << "Can't get name tables" << endl;

@ -61,7 +61,7 @@ ADD_EXECUTABLE(dfcopypaste copypaste.cpp)
TARGET_LINK_LIBRARIES(dfcopypaste dfhack)
# this needs the C bindings
IF(BUILD_DFHACK_C_BINDIGS)
IF(BUILD_DFHACK_C_BINDINGS)
# for trying out some 'stuff'
ADD_EXECUTABLE(dftest test.cpp)
TARGET_LINK_LIBRARIES(dftest dfhack)
@ -69,7 +69,7 @@ IF(BUILD_DFHACK_C_BINDIGS)
dftest
RUNTIME DESTINATION bin
)
ENDIF(BUILD_DFHACK_C_BINDIGS)
ENDIF(BUILD_DFHACK_C_BINDINGS)
install(TARGETS
dfmoodump

@ -64,7 +64,13 @@ TARGET_LINK_LIBRARIES(dfposition dfhack)
ADD_EXECUTABLE(dfdoffsets dumpoffsets.cpp)
TARGET_LINK_LIBRARIES(dfdoffsets dfhack)
# change the weather
ADD_EXECUTABLE(dfweather weather.cpp)
TARGET_LINK_LIBRARIES(dfweather dfhack)
IF(UNIX)
SET(VEINLOOK_BUILT "NO")
SET(CURSES_NEED_WIDE "YES")
SET(CURSES_NEED_NCURSES "NO")
find_package(Curses QUIET)
@ -114,11 +120,6 @@ dfexpbench
dfsuspend
dfflows
dfliquids
dfweather
RUNTIME DESTINATION bin
)
IF(UNIX)
install(TARGETS
dfveinlook
RUNTIME DESTINATION bin
)
ENDIF(UNIX)

@ -6,6 +6,7 @@
using namespace std;
#include <DFHack.h>
#include <dfhack/modules/Gui.h>
struct hideblock
{
@ -37,6 +38,19 @@ int main (void)
}
DFHack::Maps *Maps =DF->getMaps();
DFHack::Gui *Gui =DF->getGui();
// walk the map, save the hide bits, reveal.
cout << "Pausing..." << endl;
// horrible hack to make sure the pause is really set
// preblem here is that we could be 'arriving' at the wrong time and DF could be in the middle of a frame.
// that could mean that revealing, even with suspending DF's thread, would mean unleashing hell *in the same frame*
// this here hack sets the pause state, resumes DF, waits a second for it to enter the pause (I know, BS value.) and suspends.
Gui->SetPauseState(true);
DF->Resume();
sleep(1);
DF->Suspend();
// init the map
if(!Maps->Start())
{
@ -46,11 +60,12 @@ int main (void)
#endif
return 1;
}
cout << "Revealing, please wait..." << endl;
Maps->getSize(x_max,y_max,z_max);
vector <hideblock> hidesaved;
// walk the map, save the hide bits, reveal.
cout << "Revealing... please wait." << endl;
for(uint32_t x = 0; x< x_max;x++)
{
for(uint32_t y = 0; y< y_max;y++)
@ -80,8 +95,10 @@ int main (void)
}
// FIXME: force game pause here!
DF->Detach();
cout << "Map revealed. Close window/force exit to keep it that way." << endl;
cout << "Press any key to unreveal. Don't close DF or unpause in that case!" << endl;
cout << "Map revealed. The game has been paused for you." << endl;
cout << "Unpausing can unleash the forces of hell!" << endl << endl;
cout << "Press any key to unreveal." << endl;
cout << "Close to keep the map revealed." << endl;
cin.ignore();
cout << "Unrevealing... please wait." << endl;
// FIXME: do some consistency checks here!

@ -723,6 +723,7 @@ main(int argc, char *argv[])
Maps->Start();
Mats->Start();
Mats->ReadInorganicMaterials();
Mats->ReadCreatureTypes();
uint32_t effectnum;
/*
if(DF.InitReadEffects(effectnum))

@ -0,0 +1,98 @@
// Just show some position data
#include <iostream>
#include <iomanip>
#include <climits>
#include <vector>
#include <sstream>
#include <ctime>
#include <cstdio>
#define DFHACK_WANT_MISCUTILS
#define DFHACK_WANT_TILETYPES
#include <DFHack.h>
using namespace DFHack;
void printWeather(DFHack::WeatherType current)
{
switch (current)
{
case CLEAR:
cout << "The sky is clear." << endl;
cout << "Options:" << endl;
cout << "'r' to make it rain." << endl;
cout << "'s' to make it snow." << endl;
break;
case RAINING:
cout << "It is raining." << endl;
cout << "Options:" << endl;
cout << "'c' to clear the sky." << endl;
cout << "'s' to make it snow." << endl;
break;
case SNOWING:
cout << "It is snowing." << endl;
cout << "Options:" << endl;
cout << "'c' to clear the sky." << endl;
cout << "'r' to make it rain." << endl;
break;
}
cout << "'q' to quit." << endl;
cout << "anything else to refresh" << endl;
cout << ">";
}
using namespace DFHack;
int main (int numargs, const char ** args)
{
DFHack::ContextManager DFMgr("Memory.xml");
DFHack::Context *DF = DFMgr.getSingleContext();
try
{
DF->Attach();
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
#ifndef LINUX_BUILD
cin.ignore();
#endif
return 1;
}
World *W = DF->getWorld();
W->Start();
bool end = false;
while(!end)
{
WeatherType current = (WeatherType) W->ReadCurrentWeather();
DF->Resume();
string command = "";
printWeather(current);
getline(cin, command);
DF->Suspend();
if(command == "c")
{
W->SetCurrentWeather(CLEAR);
}
else if(command == "r")
{
W->SetCurrentWeather(RAINING);
}
else if(command == "s")
{
W->SetCurrentWeather(SNOWING);
}
else if(command == "q")
{
end = true;
}
}
#ifndef LINUX_BUILD
std::cout << "Done. Press any key to continue" << std::endl;
cin.ignore();
#endif
DF->Detach();
return 0;
}