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" /> <Profession name="None" id="90" military="false" can_assign_labors="true" />
</Professions> </Professions>
<Jobs> <Jobs>
TODO: Parse this and turn it into Job tags <Job id="0" name = "Carve Fortification" />
<!-- <Job id="1" name = "Detail Wall" />
[dwarf_jobs] <Job id="2" name = "Detail Floor" />
size=212 <Job id="3" name = "Dig" />
0/name = "Carve Fortification" <Job id="4" name = "Carve Upward Staircase" />
0/type = DIG <Job id="5" name = "Carve Downward Staircase" />
1/name = "Detail Wall" <Job id="6" name = "Carve Up/Down Staircase" />
1/type = TROWEL <Job id="7" name = "Carve Ramp" />
2/name = "Detail Floor" <Job id="8" name = "Dig Channel" />
2/type = TROWEL <Job id="9" name = "Fell Tree" />
3/name = "Dig" <Job id="10" name = "Gather Plants" />
3/type = DIG <Job id="11" name = "Remove Construction" />
4/name = "Carve Upward Staircase" <Job id="12" name = "Collect Webs" />
4/type = DIG <Job id="13" name = "Bring Item to Depot" />
5/name = "Carve Downward Staircase" <Job id="14" name = "Bring Item to Shop" />
5/type = DIG <Job id="15" name = "Eat" />
6/name = "Carve Up/Down Staircase" <Job id="16" name = "Get Provisions" />
6/type = DIG <Job id="17" name = "Drink" />
7/name = "Carve Ramp" <Job id="18" name = "Drink" />
7/type = DIG <Job id="19" name = "Fill Waterskin" />
8/name = "Dig Channel" <Job id="20" name = "Fill Waterskin" />
8/type = DIG <Job id="21" name = "Sleep" />
9/name = "Fell Tree" <Job id="22" name = "Collect Sand" />
9/type = CUT <Job id="23" name = "Fish" />
10/name = "Gather Plants" <Job id="24" name = "Hunt" />
11/name = "Remove Construction" <Job id="25" name = "Hunt for Small Creature" />
11/type = BUILD <Job id="26" name = "Kidnap" />
12/name = "Collect Webs" <Job id="27" name = "Beat Criminal" />
12/type = HAUL <Job id="28" name = "Starting Fist Fight" />
13/name = "Bring Item to Depot" <Job id="29" name = "Collect Taxes" />
13/type = HAUL <Job id="30" name = "Guard Tax Collector" />
14/name = "Bring Item to Shop" <Job id="31" name = "Catch Live Land Animal" />
14/type = HAUL <Job id="32" name = "Catch Live Fish" />
15/name = "Eat" <Job id="33" name = "Return Kill" />
15/type = FOOD <Job id="34" name = "Check Chesk" />
16/name = "Get Provisions" <Job id="35" name = "Store Owned Item" />
16/type = FOOD <Job id="36" name = "Place Item in Tomb" />
17/name = "Drink" <Job id="37" name = "Store Item in Stockpile" />
17/type = DRINK <Job id="38" name = "Store Item in Bag" />
18/name = "Drink" <Job id="39" name = "Store Item in Hospital" />
18/type = DRINK <Job id="40" name = "Store Item in Chest" />
19/name = "Fill Waterskin" <Job id="41" name = "Store Item in Cabinet" />
19/type = DRINK <Job id="42" name = "Store Weapon" />
20/name = "Fill Waterskin" <Job id="43" name = "Store Armor" />
20/type = DRINK <Job id="44" name = "Store Item in Barrel" />
21/name = "Sleep" <Job id="45" name = "Store Item in Bin" />
21/type = REST <Job id="46" name = "Seek Artifact" />
22/name = "Collect Sand" <Job id="47" name = "Seek Infant" />
22/type = HAUL <Job id="48" name = "Attend Party" />
23/name = "Fish" <Job id="49" name = "Go Shopping" />
24/name = "Hunt" <Job id="50" name = "Go Shopping" />
25/name = "Hunt for Small Creature" <Job id="51" name = "Clean" />
26/name = "Kidnap" <Job id="52" name = "Rest" />
26/type = FIGHT <Job id="53" name = "Pickup Equipment" />
27/name = "Beat Criminal" <Job id="54" name = "Dump Item" />
27/type = FIGHT <Job id="55" name = "Strange Mood Crafter" />
28/name = "Starting Fist Fight" <Job id="56" name = "Strange Mood Jeweller" />
28/type = FIGHT <Job id="57" name = "Strange Mood Forge" />
29/name = "Collect Taxes" <Job id="58" name = "Strange Mood Magma Forge" />
30/name = "Guard Tax Collector" <Job id="59" name = "Strange Mood Brooding" />
30/type = FIGHT <Job id="60" name = "Strange Mood Fell" />
31/name = "Catch Live Land Animal" <Job id="61" name = "Strange Mood Carpenter" />
32/name = "Catch Live Fish" <Job id="62" name = "Strange Mood Mason" />
33/name = "Return Kill" <Job id="63" name = "Strange Mood Bowyer" />
33/type = HAUL <Job id="64" name = "Strange Mood Tanner" />
34/name = "Check Chesk" <Job id="65" name = "Strange Mood Weaver" />
34/type = SEEK <Job id="66" name = "Strange Mood Glassmaker" />
35/name = "Store Owned Item" <Job id="67" name = "Strange Mood Mechanics" />
35/type = HAUL <Job id="68" name = "Construct Building" />
36/name = "Place Item in Tomb" <Job id="69" name = "Construct Door" />
36/type = HAUL <Job id="70" name = "Construct Floodgate" />
37/name = "Store Item in Stockpile" <Job id="71" name = "Construct ?? Bed" />
37/type = HAUL <Job id="72" name = "Construct ?? Chair/Throne" />
38/name = "Store Item in Bag" <Job id="73" name = "Construct ?? Casket/Sarcophagus/Coffin" />
38/type = HAUL <Job id="74" name = "Construct ?? Table" />
39/name = "Store Item in Hospital" <Job id="75" name = "Construct ?? Box/Chest/Bag/Coffer" />
39/type = HAUL <Job id="76" name = "Construct ?? Bin" />
40/name = "Store Item in Chest" <Job id="77" name = "Construct ?? Armor Stand" />
40/type = HAUL <Job id="78" name = "Construct ?? Weapon Rack" />
41/name = "Store Item in Cabinet" <Job id="79" name = "Construct ?? Cabinet" />
41/type = HAUL <Job id="80" name = "Construct ?? Statue" />
42/name = "Store Weapon" <Job id="81" name = "Construct ?? Blocks" />
42/type = HAUL <Job id="82" name = "Make Raw ??" />
43/name = "Store Armor" <Job id="83" name = "Make ?? Crafts" />
43/type = HAUL <Job id="84" name = "Mint ?? Coins" />
44/name = "Store Item in Barrel" <Job id="85" name = "Cut ?A?" />
44/type = HAUL <Job id="86" name = "Cut ?B?" />
45/name = "Store Item in Bin" <Job id="87" name = "Encrust ?something? with ?somethings?" />
45/type = HAUL <Job id="88" name = "Encrust ?something? with ?somethings?" />
46/name = "Seek Artifact" <Job id="89" name = "Destroy Building" />
46/type = SEEK <Job id="90" name = "Smelt Ore" />
47/name = "Seek Infant" <Job id="91" name = "Melt a Metal Object" />
47/type = SEEK <Job id="92" name = "Extract Metal Strands" />
48/name = "Attend Party" <Job id="93" name = "Plant Seeds" />
48/type = DRINK <Job id="94" name = "Harvest Plants" />
49/name = "Go Shopping" <Job id="95" name = "Train Hunting Animal" />
50/name = "Go Shopping" <Job id="96" name = "Train War Animal" />
51/name = "Clean" <Job id="99" name = "Construct Catapult Parts" />
52/name = "Rest" <Job id="100" name = "Forge ?? Anvil" />
52/type = REST <Job id="101" name = "Construct Catapult Parts" />
53/name = "Pickup Equipment" <Job id="102" name = "Construct Ballista Parts" />
53/type = SEEK <Job id="103" name = "Forge/Make A" />
54/name = "Dump Item" <Job id="104" name = "Stud with ?something?" />
54/type = HAUL <Job id="105" name = "Butcher an Animal" />
55/name = "Strange Mood Crafter" <Job id="106" name = "Prepare a Raw Fish" />
55/type = MOOD <Job id="107" name = "Mill Plants" />
56/name = "Strange Mood Jeweller" <Job id="108" name = "Bait Trap with Meat/Gem/Fish" />
56/type = MOOD <Job id="109" name = "Milk Creature" />
57/name = "Strange Mood Forge" <Job id="110" name = "Make Cheese" />
57/type = MOOD <Job id="111" name = "Process Plants" />
58/name = "Strange Mood Magma Forge" <Job id="112" name = "Process Plants (Bag)" />
58/type = MOOD <Job id="113" name = "Process Plants (Vial)" />
59/name = "Strange Mood Brooding" <Job id="114" name = "Process Plants (Barrel)" />
59/type = MOOD <Job id="115" name = "Prepare ?? Meal" />
60/name = "Strange Mood Fell" <Job id="116" name = "Weave ?? into ??" />
60/type = MOOD <Job id="117" name = "Forge/Make ?? something" />
61/name = "Strange Mood Carpenter" <Job id="118" name = "Weave Thread" />
61/type = MOOD <Job id="119" name = "Forge/Make D" />
62/name = "Strange Mood Mason" <Job id="120" name = "Forge/Make E" />
62/type = MOOD <Job id="121" name = "Forge/Make F" />
63/name = "Strange Mood Bowyer" <Job id="122" name = "Forge/Make Waterskin/Vial/Flask" />
63/type = MOOD <Job id="123" name = "Forge Rope" />
64/name = "Strange Mood Tanner" <Job id="124" name = "Forge Flask" />
64/type = MOOD <Job id="125" name = "Forge Goblet" />
65/name = "Strange Mood Weaver" <Job id="126" name = "Forge Instrument" />
65/type = MOOD <Job id="127" name = "Forge Toy" />
66/name = "Strange Mood Glassmaker" <Job id="128" name = "Forge Animal Trap" />
66/type = MOOD <Job id="129" name = "Forge Barrel" />
67/name = "Strange Mood Mechanics" <Job id="130" name = "Make Totel" />
67/type = MOOD <Job id="131" name = "Forge Bolts" />
68/name = "Construct Building" <Job id="132" name = "Decorate With ?something?" />
68/type = BUILD <Job id="133" name = "Forge/Make G" />
69/name = "Construct Door" <Job id="134" name = "Decorate With Bone" />
68/type = BUILD <Job id="135" name = "Make Backpack" />
70/name = "Construct Floodgate" <Job id="136" name = "Make Quiver" />
70/type = BUILD <Job id="137" name = "Load Catapult" />
71/name = "Construct ?? Bed" <Job id="138" name = "Load Ballista" />
71/type = BUILD <Job id="139" name = "Fire Catapult" />
72/name = "Construct ?? Chair/Throne" <Job id="140" name = "Fire Ballista" />
72/type = BUILD <Job id="141" name = "Construct Mechanisms" />
73/name = "Construct ?? Casket/Sarcophagus/Coffin" <Job id="142" name = "Fire Ballista" />
73/type = BUILD <Job id="143" name = "Load Cage Trap" />
74/name = "Construct ?? Table" <Job id="144" name = "Load Stone Trap" />
74/type = BUILD <Job id="145" name = "Load Weapon Trap" />
75/name = "Construct ?? Box/Chest/Bag/Coffer" <Job id="146" name = "Clean Trap" />
75/type = BUILD <Job id="147" name = "Cast Spell" />
76/name = "Construct ?? Bin" <Job id="148" name = "Link a Building to Trigger" />
76/type = BUILD <Job id="149" name = "Pull the Lever" />
77/name = "Construct ?? Armor Stand" <Job id="150" name = "Brew Drink" />
77/type = BUILD <Job id="151" name = "Extract from Plants" />
78/name = "Construct ?? Weapon Rack" <Job id="152" name = "Extract from Raw Fish" />
78/type = BUILD <Job id="153" name = "Extract from Land Animal" />
79/name = "Construct ?? Cabinet" <Job id="154" name = "Tame Small Animal" />
79/type = BUILD <Job id="155" name = "Tame ?something?" />
80/name = "Construct ?? Statue" <Job id="156" name = "Chain Animal" />
80/type = BUILD <Job id="157" name = "Unchain Animal" />
81/name = "Construct ?? Blocks" <Job id="158" name = "Unchain Pet" />
81/type = BUILD <Job id="159" name = "Release Large Creature" />
82/name = "Make Raw ??" <Job id="160" name = "Release Pet" />
83/name = "Make ?? Crafts" <Job id="161" name = "Release Small Creature" />
84/name = "Mint ?? Coins" <Job id="162" name = "Handle Small Creature" />
85/name = "Cut ?A?" <Job id="163" name = "Handle Large Creature" />
86/name = "Cut ?B?" <Job id="164" name = "Cage Large Creature" />
87/name = "Encrust ?something? with ?somethings?" <Job id="165" name = "Cage Small Creature" />
88/name = "Encrust ?something? with ?somethings?" <Job id="166" name = "Recover Wounded" />
89/name = "Destroy Building" <Job id="167" name = "Diagnose Patient" />
89/type = BUILD <Job id="168" name = "Immobilize Break" />
90/name = "Smelt Ore" <Job id="169" name = "Dress Wound" />
90/type = FURNACE <Job id="170" name = "Clean Patient" />
91/name = "Melt a Metal Object" <Job id="171" name = "Surgery" />
91/type = FORGE <Job id="172" name = "Suture" />
92/name = "Extract Metal Strands" <Job id="173" name = "Set Bone" />
92/type = FORGE <Job id="174" name = "Place In Traction" />
93/name = "Plant Seeds" <Job id="175" name = "Drain Aquarium" />
94/name = "Harvest Plants" <Job id="176" name = "Fill Aquarium" />
95/name = "Train Hunting Animal" <Job id="177" name = "Fill Pond" />
95/type = ANIMAL <Job id="178" name = "Give Water" />
96/name = "Train War Animal" <Job id="179" name = "Give Food" />
96/type = ANIMAL <Job id="180" name = "Give Water" />
99/name = "Construct Catapult Parts" <Job id="181" name = "Give Food" />
100/name = "Forge ?? Anvil" <Job id="182" name = "Recover Pet" />
100/type = FORGE <Job id="183" name = "Pit/Pond Large Animal" />
101/name = "Construct Catapult Parts" <Job id="184" name = "Pit/Pond Small Animal" />
102/name = "Construct Ballista Parts" <Job id="185" name = "Slaughter Animal" />
103/name = "Forge/Make A" <Job id="186" name = "Make Charcoal" />
103/type = FORGE <Job id="187" name = "Make Ash" />
104/name = "Stud with ?something?" <Job id="188" name = "Make Lye" />
105/name = "Butcher an Animal" <Job id="189" name = "Make Potash From Lye" />
106/name = "Prepare a Raw Fish" <Job id="190" name = "Fertilize Field" />
107/name = "Mill Plants" <Job id="191" name = "Make Potash From Ash" />
108/name = "Bait Trap with Meat/Gem/Fish" <Job id="192" name = "Dye Thread" />
109/name = "Milk Creature" <Job id="193" name = "Dye Cloth" />
110/name = "Make Cheese" <Job id="194" name = "Sew ?? Image" />
111/name = "Process Plants" <Job id="195" name = "Manage Work Orders" />
112/name = "Process Plants (Bag)" <Job id="196" name = "Operate Pump" />
113/name = "Process Plants (Vial)" <Job id="197" name = "Manage Work Orders" />
114/name = "Process Plants (Barrel)" <Job id="198" name = "Update Stockpile Records" />
115/name = "Prepare ?? Meal" <Job id="199" name = "Trade at Depot" />
116/name = "Weave ?? into ??" <Job id="200" name = "Construct ?? Hatch Cover" />
117/name = "Forge/Make ?? something" <Job id="201" name = "Construct ?? Grate" />
117/type = BUILD <Job id="202" name = "Remove Stairs/Ramps" />
118/name = "Weave Thread" <Job id="203" name = "Construct ?? Quern" />
119/name = "Forge/Make D" <Job id="205" name = "Upgrade Squad Equipment" />
119/type = FORGE <Job id="206" name = "Prepare Equipment Manifests" />
120/name = "Forge/Make E" <Job id="207" name = "Construct ?? Splint" />
120/type = FORGE <Job id="208" name = "Construct ?? Crutch" />
121/name = "Forge/Make F" <Job id="209" name = "Construct Traction Bench" />
121/type = FORGE <Job id="210" name = "Clean Self" />
122/name = "Forge/Make Waterskin/Vial/Flask" <Job id="211" name = "Bring Crutch" />
122/type = FORGE <Job id="212" name = "Apply Cast" />
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
-->
</Jobs> </Jobs>
<Skills> <Skills>
<Skill name="Mining" id="0" /> <Skill name="Mining" id="0" />
@ -892,7 +745,7 @@
</Group> </Group>
</Group> </Group>
<Group name="Creatures" description="Offsets used by the Creatures module."> <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_race" description="Index of the current player race." />
<Address name="current_civ" description="Index of the current player civilization." /> <Address name="current_civ" description="Index of the current player civilization." />
<Group name="creature"> <Group name="creature">
@ -939,11 +792,11 @@
<Offset name="type" description="seems to be just like the old occupations" /> <Offset name="type" description="seems to be just like the old occupations" />
<Offset name="materials_vector" /> <Offset name="materials_vector" />
<Group name="material"> <Group name="material">
<Offset name="material_maintype" description="like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ..." /> <Offset name="maintype" description="like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ..." />
<Offset name="material_sectype1" description="subsubtype ?" /> <Offset name="sectype1" description="subsubtype ?" />
<Offset name="material_sectype2" description="subtype ?" /> <Offset name="sectype2" description="subtype ?" />
<Offset name="material_sectype3" description="index of material (for example, 2 is for silver)" /> <Offset name="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="flags" description="set only for shell / bone mood requirements ?" />
</Group> </Group>
</Group> </Group>
</Group> </Group>
@ -953,7 +806,7 @@
<Address name="organics_plants" description="plant matter" /> <Address name="organics_plants" description="plant matter" />
<Address name="organics_trees" description="just wood" /> <Address name="organics_trees" description="just wood" />
<Address name="creature_type_vector" description="A vector of creature races" /> <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"> <Group name="creature" description="Creature race objects">
<Offset name="caste_vector" description="A race is divided into castes. Normally male and female."/> <Offset name="caste_vector" description="A race is divided into castes. Normally male and female."/>
<Offset name="extract_vector"/> <Offset name="extract_vector"/>
@ -1032,6 +885,7 @@
<Group name="World"> <Group name="World">
<Address name="current_tick" description="Current time of the year" /> <Address name="current_tick" description="Current time of the year" />
<Address name="current_year" description="Current 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> </Group>
</Offsets> </Offsets>
</Base> </Base>
@ -1168,7 +1022,7 @@
</Group> </Group>
</Group> </Group>
<Group name="Creatures"> <Group name="Creatures">
<Address name="creature_vector" value="0x0166ecc4" /> <Address name="vector" value="0x0166ecc4" />
<Address name="current_race" value="0x01470fbc" /> <Address name="current_race" value="0x01470fbc" />
<Address name="current_civ" value="0x01470fb0" /> <Address name="current_civ" value="0x01470fb0" />
<Group name="creature"> <Group name="creature">
@ -1214,11 +1068,11 @@
<Offset name="type" value="0x8" /> seems to be just like the old occupations <Offset name="type" value="0x8" /> seems to be just like the old occupations
<Offset name="materials_vector" value="0xa4" /> <Offset name="materials_vector" value="0xa4" />
<Group name="material"> <Group name="material">
<Offset name="material_maintype" value="0x0" /> like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ... <Offset name="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="sectype1" value="0x2" /> subsubtype ?
<Offset name="material_sectype2" value="0x4" /> subtype ? <Offset name="sectype2" value="0x4" /> subtype ?
<Offset name="material_sectype3" value="0x8" /> index of material (for example, 2 is for silver) <Offset name="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="flags" value="0x18" /> set only for shell / bone mood requirements ?
</Group> </Group>
</Group> </Group>
</Group> </Group>
@ -1350,7 +1204,7 @@
</Group> </Group>
</Group> </Group>
<Group name="Creatures"> <Group name="Creatures">
<Address name="creature_vector" value="0x166FD0C" /> <Address name="vector" value="0x166FD0C" />
<Group name="creature"> <Group name="creature">
<Group name="advanced"> <Group name="advanced">
<Offset name="artifact_name" value="0x6D4" /> <Offset name="artifact_name" value="0x6D4" />
@ -1368,6 +1222,7 @@
<Address name="organics_plants" value="0x16B0D7C" /><!--plant matter, WORLD + 0x54BAC--> <Address name="organics_plants" value="0x16B0D7C" /><!--plant matter, WORLD + 0x54BAC-->
<Address name="organics_trees" value="0x16B0DAC" /><!--just wood, WORLD + 0x54BDC--> <Address name="organics_trees" value="0x16B0DAC" /><!--just wood, WORLD + 0x54BDC-->
<Address name="creature_type_vector" value="0x16B0EA0" /><!--WORLD + 0x54CD0--> <Address name="creature_type_vector" value="0x16B0EA0" /><!--WORLD + 0x54CD0-->
<Address name="other" value="0x16BA114" />
<Group name="descriptors"> <Group name="descriptors">
<Address name="vectors_start" value="0x16B9780" /> <Address name="vectors_start" value="0x16B9780" />
<Offset name="rawname" value="0x0" /> <Offset name="rawname" value="0x0" />
@ -1419,7 +1274,7 @@
<PETimeStamp value="0x4bf014fa" /> <PETimeStamp value="0x4bf014fa" />
<Offsets> <Offsets>
<Group name="Creatures"> <Group name="Creatures">
<Address name="creature_vector" value="0x167870C" /> <Address name="vector" value="0x167870C" />
<Address name="current_race" value="0x1471FBC" /> <Address name="current_race" value="0x1471FBC" />
<Address name="current_civ" value="0x1471FB0" /> <Address name="current_civ" value="0x1471FB0" />
</Group> </Group>
@ -1430,6 +1285,7 @@
<Address name="organics_plants" value="0x16bd0e0" /> <Address name="organics_plants" value="0x16bd0e0" />
<Address name="organics_trees" value="0x16bd110" /> <Address name="organics_trees" value="0x16bd110" />
<Address name="creature_type_vector" value="0x16BD204" /> <Address name="creature_type_vector" value="0x16BD204" />
<Address name="other" value="0x16C6478"/>
<Group name="descriptors"> <Group name="descriptors">
<Address name="colors_vector" value="0x16C5ACC" /> <Address name="colors_vector" value="0x16C5ACC" />
<Address name="vectors_start" value="0x16C5AE4" /> <Address name="vectors_start" value="0x16C5AE4" />
@ -1553,7 +1409,7 @@
<Address name="translation_vector" value="0x16D33FC" /> <Address name="translation_vector" value="0x16D33FC" />
</Group> </Group>
<Group name="Creatures"> <Group name="Creatures">
<Address name="creature_vector" value="0x168E73C" /> <Address name="vector" value="0x168E73C" />
<Address name="current_race" value="0x014b9f1c" /> <Address name="current_race" value="0x014b9f1c" />
<Group name="creature"> <Group name="creature">
<Group name="advanced"> <Group name="advanced">
@ -1593,9 +1449,37 @@
<Group name="Position"> <Group name="Position">
<Address name="screen_tiles_pointer" value="0x18313D0" /> <Address name="screen_tiles_pointer" value="0x18313D0" />
</Group> </Group>
<Group name="World">
<Address name="current_weather" value="0x14BCDEE" />
</Group>
</Offsets> </Offsets>
</Version> </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> </Group>
<Group name="Creatures"> <Group name="Creatures">
<Address name="creature_vector" value="0x92D9AC0" /> <Address name="vector" value="0x92D9AC0" />
<Address name="current_race" value="0x92C1628" /> <Address name="current_race" value="0x92C1628" />
<Address name="current_civ" value="0x92C161C" /> <Address name="current_civ" value="0x92C161C" />
<Group name="creature" valid="verify" > <Group name="creature" valid="verify" >
@ -1708,7 +1592,7 @@
<Offset name="custom_profession" value="0x3c" /> <Offset name="custom_profession" value="0x3c" />
<Offset name="profession" value="0x40" /> <Offset name="profession" value="0x40" />
<Offset name="race" value="0x44" /> <Offset name="race" value="0x44" />
<Offset name="position" value="0x90" /> <Offset name="position" value="0x48" />
<Offset name="flags1" value="0x8C" /> <Offset name="flags1" value="0x8C" />
<Offset name="flags2" value="0x90" /> <Offset name="flags2" value="0x90" />
<Offset name="caste" value="0xA4" /> <Offset name="caste" value="0xA4" />
@ -1731,24 +1615,26 @@
<Offset name="happiness" value="0x5AC" /> <Offset name="happiness" value="0x5AC" />
</Group> </Group>
</Group> </Group>
<!--
The vector is bad.
<Group name="soul" valid="verify"> <Group name="soul" valid="verify">
<Offset name="name" value="0x0" /> <Offset name="name" value="0x0" />
<Offset name="mental" value="0x88" /> <Offset name="mental" value="0x88" />
<Offset name="skills_vector" value="0x1C4" /> CHMOD <Offset name="skills_vector" value="0x1C4" /> CHMOD
<Offset name="traits" value="0x1DC" /> <Offset name="traits" value="0x1DC" />
</Group> </Group>
-->
<!-- <!--
<Group name="job"> <Group name="job">
<Offset name="id" value="0x0" /> Incrementaly assigned <Offset name="id" value="0x0" /> Incrementaly assigned
<Offset name="type" value="0x8" /> seems to be just like the old occupations <Offset name="type" value="0x8" /> seems to be just like the old occupations
<Offset name="materials_vector" value="0xa4" /> <Offset name="materials_vector" value="0xa4" />
<Group name="material"> <Group name="material">
<Offset name="material_maintype" value="0x0" /> like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ... <Offset name="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="sectype1" value="0x2" /> subsubtype ?
<Offset name="material_sectype2" value="0x4" /> subtype ? <Offset name="sectype2" value="0x4" /> subtype ?
<Offset name="material_sectype3" value="0x8" /> index of material (for example, 2 is for silver) <Offset name="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="flags" value="0x18" /> set only for shell / bone mood requirements ?
</Group> </Group>
</Group> </Group>
--> -->
@ -1764,6 +1650,8 @@
<Offset name="extract_vector" value="0x18f4" /> <Offset name="extract_vector" value="0x18f4" />
<Offset name="tile" value="0x20" /> <Offset name="tile" value="0x20" />
<Offset name="tile_color" value="0x36" /> <Offset name="tile_color" value="0x36" />
<!--
!!!! BOGUS !!!!
<Group name="caste"> <Group name="caste">
<Offset name="bodypart_vector" value="0x51C" /> <Offset name="bodypart_vector" value="0x51C" />
<Offset name="attributes" value="0x654" /> <Offset name="attributes" value="0x654" />
@ -1781,6 +1669,7 @@
<Offset name="singular_vector" value="0x78" /> <Offset name="singular_vector" value="0x78" />
<Offset name="plural_vector" value="0x90" /> <Offset name="plural_vector" value="0x90" />
</Group> </Group>
-->
</Group> </Group>
<Group name="descriptors"> <Group name="descriptors">
<!--<Address name="vectors_start" value="" />--><!-- search: vector of object with first object having string "STAR" as first member --> <!--<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"> <Version name="v0.31.12 linux" os="linux" base="v0.31.11 linux" rebase="-0x1000">
<MD5 value="e79cead03187ecb692961b316b7cdcd4" /> <MD5 value="e79cead03187ecb692961b316b7cdcd4" />
<Offsets> <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"> <Group name="Position">
<Address name="screen_tiles_pointer" value="0x09487970" /> <Address name="screen_tiles_pointer" value="0x09487970" />
</Group> </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> </Offsets>
</Version> </Version>
</DFHack> </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/depends/argstream/)
include_directories (${CMAKE_SOURCE_DIR}/library/private/) include_directories (${CMAKE_SOURCE_DIR}/library/private/)
SET(PROJECT_HDRS SET(PROJECT_HDRS_INTERNAL
private/ContextShared.h private/ContextShared.h
private/Internal.h private/Internal.h
)
SET(PROJECT_HDRS
include/DFHack.h
include/dfhack/DFContext.h
include/dfhack/DFContextManager.h
include/dfhack/DFError.h include/dfhack/DFError.h
include/dfhack/VersionInfoFactory.h include/dfhack/DFExport.h
include/dfhack/VersionInfo.h include/dfhack/DFGlobal.h
include/dfhack/DFProcessEnumerator.h include/dfhack/DFIntegers.h
include/dfhack/DFMiscUtils.h
include/dfhack/DFModule.h
include/dfhack/DFPragma.h
include/dfhack/DFProcess.h include/dfhack/DFProcess.h
include/dfhack/DFProcessEnumerator.h
include/dfhack/DFTileTypes.h include/dfhack/DFTileTypes.h
include/dfhack/DFTypes.h include/dfhack/DFTypes.h
include/dfhack/DFVector.h include/dfhack/DFVector.h
include/dfhack-c/DFTypes_C.h include/dfhack/VersionInfoFactory.h
include/dfhack-c/DFContext_C.h include/dfhack/VersionInfo.h
include/dfhack/DFIntegers.h
include/dfhack/modules/Buildings.h include/dfhack/modules/Buildings.h
include/dfhack/modules/Constructions.h include/dfhack/modules/Constructions.h
include/dfhack/modules/Creatures.h include/dfhack/modules/Creatures.h
@ -55,8 +64,21 @@ include/dfhack/modules/World.h
) )
SET(PROJECT_C_HDRS SET(PROJECT_C_HDRS
include/DFHack_C.h
include/dfhack-c/DFTypes_C.h include/dfhack-c/DFTypes_C.h
include/dfhack-c/DFContext_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 SET(PROJECT_SRCS
@ -206,4 +228,5 @@ endif(MSVC)
IF(UNIX) IF(UNIX)
install(TARGETS dfhack LIBRARY DESTINATION lib) install(TARGETS dfhack LIBRARY DESTINATION lib)
install(FILES ${CMAKE_SOURCE_DIR}/output/Memory.xml DESTINATION share/dfhack) 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) ENDIF(UNIX)

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

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

@ -32,6 +32,7 @@
#include "dfhack/modules/Items.h" #include "dfhack/modules/Items.h"
#include "dfhack/modules/Vegetation.h" #include "dfhack/modules/Vegetation.h"
#include "dfhack/modules/Maps.h" #include "dfhack/modules/Maps.h"
#include "dfhack/modules/Gui.h"
/* /*
* This is a header full of ugly, volatile things. * 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_ReadCurrentMonth(DFHackObject* world, uint32_t* month);
DFHACK_EXPORT int World_ReadCurrentDay(DFHackObject* world, uint32_t* day); 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 #ifdef __cplusplus
} }
#endif #endif

@ -34,7 +34,12 @@ namespace DFHack
{ {
namespace Error 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: public:
virtual const char* what() const throw() 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: public:
virtual const char* what() const throw() 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: public:
virtual const char* what() const throw() 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: public:
BadMapDimensions(uint32_t& _x, uint32_t& _y) : x(_x), y(_y) {} 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 // a call to DFHack::mem_info::get* failed
class DFHACK_EXPORT MissingMemoryDefinition : public std::exception class DFHACK_EXPORT MissingMemoryDefinition : public All
{ {
public: public:
MissingMemoryDefinition(const char* _type, const std::string _key) : type(_type), key(_key) 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 // a call to DFHack::mem_info::get* failed
class DFHACK_EXPORT UnsetMemoryDefinition : public std::exception class DFHACK_EXPORT UnsetMemoryDefinition : public All
{ {
public: public:
UnsetMemoryDefinition(const char* _type, const std::string _key) : type(_type), key(_key) 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 // Syntax errors and whatnot, the xml cant be read
class DFHACK_EXPORT MemoryXmlParse : public std::exception class DFHACK_EXPORT MemoryXmlParse : public All
{ {
public: public:
MemoryXmlParse(const char* _desc, int _id, int _row, int _col) 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: public:
MemoryXmlBadAttribute(const char* _attr) : attr(_attr) 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: public:
MemoryXmlNoRoot() {} MemoryXmlNoRoot() {}
@ -200,7 +205,7 @@ namespace DFHack
} }
}; };
class DFHACK_EXPORT MemoryXmlNoDFExtractor : public std::exception class DFHACK_EXPORT MemoryXmlNoDFExtractor : public All
{ {
public: public:
MemoryXmlNoDFExtractor(const char* _name) : name(_name) 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: public:
MemoryXmlUnderspecifiedEntry(const char * _where) : where(_where) 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: public:
MemoryXmlUnknownType(const char* _type) : type(_type) 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: public:
SHMServerDisappeared(){} SHMServerDisappeared(){}
@ -268,7 +273,7 @@ namespace DFHack
return "The server process has disappeared"; return "The server process has disappeared";
} }
}; };
class DFHACK_EXPORT SHMLockingError : public std::exception class DFHACK_EXPORT SHMLockingError : public All
{ {
public: public:
SHMLockingError(const char* _type) : type(_type) SHMLockingError(const char* _type) : type(_type)
@ -287,7 +292,7 @@ namespace DFHack
return full.c_str(); return full.c_str();
} }
}; };
class DFHACK_EXPORT MemoryAccessDenied : public std::exception class DFHACK_EXPORT MemoryAccessDenied : public All
{ {
public: public:
MemoryAccessDenied() {} MemoryAccessDenied() {}
@ -297,7 +302,7 @@ namespace DFHack
return "SHM ACCESS DENIED"; return "SHM ACCESS DENIED";
} }
}; };
class DFHACK_EXPORT SHMVersionMismatch : public std::exception class DFHACK_EXPORT SHMVersionMismatch : public All
{ {
public: public:
SHMVersionMismatch() {} SHMVersionMismatch() {}
@ -307,7 +312,7 @@ namespace DFHack
return "SHM VERSION MISMATCH"; return "SHM VERSION MISMATCH";
} }
}; };
class DFHACK_EXPORT SHMAttachFailure : public std::exception class DFHACK_EXPORT SHMAttachFailure : public All
{ {
public: public:
SHMAttachFailure() {} SHMAttachFailure() {}
@ -317,7 +322,7 @@ namespace DFHack
return "SHM ATTACH FAILURE"; return "SHM ATTACH FAILURE";
} }
}; };
class DFHACK_EXPORT ModuleNotInitialized : public std::exception class DFHACK_EXPORT ModuleNotInitialized : public All
{ {
public: public:
ModuleNotInitialized() {} ModuleNotInitialized() {}

@ -22,6 +22,8 @@ namespace DFHack
///true if paused, false if not ///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 /// read the DF menu view state (stock screen, unit screen, other screens
bool ReadViewScreen(t_viewscreen &); bool ReadViewScreen(t_viewscreen &);
/// read the DF menu state (designation menu ect) /// read the DF menu state (designation menu ect)

@ -9,6 +9,12 @@
namespace DFHack namespace DFHack
{ {
enum WeatherType
{
CLEAR,
RAINING,
SNOWING
};
class DFContextShared; class DFContextShared;
class DFHACK_EXPORT World : public Module class DFHACK_EXPORT World : public Module
{ {
@ -23,6 +29,8 @@ namespace DFHack
uint32_t ReadCurrentYear(); uint32_t ReadCurrentYear();
uint32_t ReadCurrentMonth(); uint32_t ReadCurrentMonth();
uint32_t ReadCurrentDay(); uint32_t ReadCurrentDay();
uint8_t ReadCurrentWeather();
void SetCurrentWeather(uint8_t weather);
private: private:
struct Private; struct Private;

@ -50,10 +50,16 @@ struct Creatures::Private
{ {
bool Inited; bool Inited;
bool Started; bool Started;
bool Ft_basic;
bool Ft_advanced;
bool Ft_jobs;
bool Ft_soul;
Creatures2010::creature_offsets creatures; Creatures2010::creature_offsets creatures;
uint32_t creature_module; uint32_t creature_module;
uint32_t dwarf_race_index_addr; uint32_t dwarf_race_index_addr;
uint32_t dwarf_civ_id_addr; uint32_t dwarf_civ_id_addr;
OffsetGroup * OG_jobs;
OffsetGroup * OG_job_mats;
DfVector <uint32_t> *p_cre; DfVector <uint32_t> *p_cre;
DFContextShared *d; DFContextShared *d;
Process *owner; Process *owner;
@ -67,29 +73,41 @@ Creatures::Creatures(DFContextShared* _d)
d->Inited = false; d->Inited = false;
d->Started = false; d->Started = false;
d->d->InitReadNames(); // throws on error d->d->InitReadNames(); // throws on error
try
{
VersionInfo * minfo = d->d->offset_descriptor; VersionInfo * minfo = d->d->offset_descriptor;
Creatures2010::creature_offsets &creatures = d->creatures;
OffsetGroup *OG_Creatures = minfo->getGroup("Creatures"); 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
{ {
// Creatures
creatures.vector = OG_Creatures->getAddress ("vector"); creatures.vector = OG_Creatures->getAddress ("vector");
d->dwarf_race_index_addr = OG_Creatures->getAddress("current_race"); d->dwarf_race_index_addr = OG_Creatures->getAddress("current_race");
d->dwarf_civ_id_addr = OG_Creatures->getAddress("current_civ"); d->dwarf_civ_id_addr = OG_Creatures->getAddress("current_civ");
OffsetGroup *OG_creature = OG_Creatures->getGroup("creature"); // Creatures/creature
{
creatures.name_offset = OG_creature->getOffset ("name"); creatures.name_offset = OG_creature->getOffset ("name");
creatures.custom_profession_offset = OG_creature->getOffset ("custom_profession"); creatures.custom_profession_offset = OG_creature->getOffset ("custom_profession");
creatures.profession_offset = OG_creature->getOffset ("profession"); creatures.profession_offset = OG_creature->getOffset ("profession");
creatures.race_offset = OG_creature->getOffset ("race"); creatures.race_offset = OG_creature->getOffset ("race");
creatures.pos_offset = OG_creature->getOffset ("position"); creatures.pos_offset = OG_creature->getOffset ("position");
creatures.flags1_offset = OG_creature->getOffset ("creature_flags1"); creatures.flags1_offset = OG_creature->getOffset ("flags1");
creatures.flags2_offset = OG_creature->getOffset ("creature_flags2"); creatures.flags2_offset = OG_creature->getOffset ("flags2");
creatures.sex_offset = OG_creature->getOffset ("sex"); creatures.sex_offset = OG_creature->getOffset ("sex");
creatures.caste_offset = OG_creature->getOffset ("caste"); creatures.caste_offset = OG_creature->getOffset ("caste");
creatures.id_offset = OG_creature->getOffset ("id"); creatures.id_offset = OG_creature->getOffset ("id");
creatures.civ_offset = OG_creature->getOffset ("civ"); creatures.civ_offset = OG_creature->getOffset ("civ");
OffsetGroup *OG_creature_ex = OG_creature->getGroup("advanced"); // 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.inventory_offset = OG_creature_ex->getOffset("inventory_vector"); creatures.inventory_offset = OG_creature_ex->getOffset("inventory_vector");
creatures.pickup_equipment_bit = OG_creature_ex->getOffset("pickup_equipment_bit"); creatures.pickup_equipment_bit = OG_creature_ex->getOffset("pickup_equipment_bit");
@ -103,45 +121,25 @@ Creatures::Creatures(DFContextShared* _d)
creatures.physical_offset = OG_creature_ex->getOffset("physical"); creatures.physical_offset = OG_creature_ex->getOffset("physical");
creatures.appearance_vector_offset = OG_creature_ex->getOffset("appearance_vector"); creatures.appearance_vector_offset = OG_creature_ex->getOffset("appearance_vector");
creatures.artifact_name_offset = OG_creature_ex->getOffset("artifact_name"); 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.labors_offset = OG_creature_ex->getOffset ("labors");
creatures.happiness_offset = OG_creature_ex->getOffset ("happiness"); creatures.happiness_offset = OG_creature_ex->getOffset ("happiness");
d->Ft_advanced = true;
} }
} catch(Error::All&){};
OffsetGroup *OG_soul = OG_Creatures->getGroup("soul"); try
{ {
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_mental_offset = OG_soul->getOffset("mental");
creatures.soul_skills_vector_offset = OG_soul->getOffset("skills_vector"); creatures.soul_skills_vector_offset = OG_soul->getOffset("skills_vector");
creatures.soul_traits_offset = OG_soul->getOffset("traits"); creatures.soul_traits_offset = OG_soul->getOffset("traits");
d->Ft_soul = true;
} }
catch(Error::All&){};
} }
// name offsets for the creature module catch(Error::All&){};
OffsetGroup * OG_name = minfo->getGroup("name");
{
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");
}
/*
// upload offsets to the SHM
if(p->getModuleIndex("Creatures2010",1,d->creature_module))
{
// 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);
}
*/
d->Inited = true; d->Inited = true;
} }
catch (Error::MissingMemoryDefinition&)
{
d->Inited = false;
throw;
}
}
Creatures::~Creatures() Creatures::~Creatures()
{ {
@ -171,6 +169,7 @@ bool Creatures::Finish()
bool Creatures::ReadCreature (const int32_t index, t_creature & furball) bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
{ {
if(!d->Started) return false; if(!d->Started) return false;
memset(&furball, 0, sizeof(t_creature));
// SHM fast path // SHM fast path
Process * p = d->owner; Process * p = d->owner;
/* /*
@ -192,12 +191,12 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
Creatures2010::creature_offsets &offs = d->creatures; Creatures2010::creature_offsets &offs = d->creatures;
//read creature from memory //read creature from memory
if(d->Ft_basic)
{
// name // name
d->d->readName(furball.name,temp + offs.name_offset); d->d->readName(furball.name,temp + offs.name_offset);
// basic stuff // basic stuff
p->readDWord (temp + offs.happiness_offset, furball.happiness);
p->readDWord (temp + offs.id_offset, furball.id); 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->read (temp + offs.pos_offset, 3 * sizeof (uint16_t), (uint8_t *) & (furball.x)); // xyz really
p->readDWord (temp + offs.race_offset, furball.race); p->readDWord (temp + offs.race_offset, furball.race);
@ -206,6 +205,15 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
p->readWord (temp + offs.caste_offset, furball.caste); p->readWord (temp + offs.caste_offset, furball.caste);
p->readDWord (temp + offs.flags1_offset, furball.flags1.whole); p->readDWord (temp + offs.flags1_offset, furball.flags1.whole);
p->readDWord (temp + offs.flags2_offset, furball.flags2.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);
}
if(d->Ft_advanced)
{
// happiness
p->readDWord (temp + offs.happiness_offset, furball.happiness);
// physical attributes // physical attributes
p->read(temp + offs.physical_offset, p->read(temp + offs.physical_offset,
@ -217,50 +225,36 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
furball.mood_skill = p->readWord (temp + offs.mood_skill_offset); furball.mood_skill = p->readWord (temp + offs.mood_skill_offset);
d->d->readName(furball.artifact_name, temp + offs.artifact_name_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 // labors
p->read (temp + offs.labors_offset, NUM_CREATURE_LABORS, furball.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)
{
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") );
}
else
{
furball.current_job.active = false;;
}
furball.birth_year = p->readDWord (temp + offs.birth_year_offset ); furball.birth_year = p->readDWord (temp + offs.birth_year_offset );
furball.birth_time = p->readDWord (temp + offs.birth_time_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); * p->readDWord(temp + offs.creature_pregnancy_offset, furball.pregnancy_timer);
*/
if (jobIdAddr) // appearance
{ DfVector <uint32_t> app(p, temp + offs.appearance_vector_offset);
furball.current_job.active = true; furball.nbcolors = app.size();
furball.current_job.jobId = p->readByte (jobIdAddr + offs.creature_current_job_id_offset); if(furball.nbcolors>MAX_COLORS)
} furball.nbcolors = MAX_COLORS;
else for(uint32_t i = 0; i < furball.nbcolors; i++)
{ {
furball.current_job.active = false; furball.color[i] = app[i];
} }
*/
//likes
/* /*
p->readDWord(temp + offs.creature_pregnancy_offset, furball.pregnancy_timer); 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]);
}*/
}
if(d->Ft_soul)
{
/* /*
// enum soul pointer vector // enum soul pointer vector
DfVector <uint32_t> souls(p,temp + offs.creature_soul_vector_offset); DfVector <uint32_t> souls(p,temp + offs.creature_soul_vector_offset);
@ -296,25 +290,21 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
sizeof (uint16_t) * NUM_CREATURE_TRAITS, sizeof (uint16_t) * NUM_CREATURE_TRAITS,
(uint8_t *) &furball.defaultSoul.traits); (uint8_t *) &furball.defaultSoul.traits);
} }
}
DfVector <uint32_t> app(p, temp + offs.appearance_vector_offset); if(d->Ft_jobs)
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]; 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") );
} }
//likes else
/*
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]; furball.current_job.active = false;;
p->read(temp2,sizeof(t_like),(uint8_t *) &furball.likes[i]); }
}*/ }
return true; return true;
} }
@ -538,17 +528,15 @@ bool Creatures::WriteJob(const t_creature * furball, std::vector<t_material> con
if(!d->Inited) return false; if(!d->Inited) return false;
if(!furball->current_job.active) return false; if(!furball->current_job.active) return false;
Process * p = d->owner; Process * p = d->owner;
VersionInfo * minfo = d->d->offset_descriptor; DfVector <uint32_t> cmats(p, furball->current_job.occupationPtr + d->OG_jobs->getOffset("materials_vector"));
DfVector <uint32_t> cmats(p, furball->current_job.occupationPtr + minfo->getOffset("job_materials_vector"));
for(i=0;i<cmats.size();i++) for(i=0;i<cmats.size();i++)
{ {
p->writeWord(cmats[i] + minfo->getOffset("job_material_maintype"), mat[i].itemType); p->writeWord(cmats[i] + d->OG_job_mats->getOffset("maintype"), mat[i].itemType);
p->writeWord(cmats[i] + minfo->getOffset("job_material_sectype1"), mat[i].subType); p->writeWord(cmats[i] + d->OG_job_mats->getOffset("sectype1"), mat[i].subType);
p->writeWord(cmats[i] + minfo->getOffset("job_material_sectype2"), mat[i].subIndex); p->writeWord(cmats[i] + d->OG_job_mats->getOffset("sectype2"), mat[i].subIndex);
p->writeDWord(cmats[i] + minfo->getOffset("job_material_sectype3"), mat[i].index); p->writeDWord(cmats[i] + d->OG_job_mats->getOffset("sectype3"), mat[i].index);
p->writeDWord(cmats[i] + minfo->getOffset("job_material_flags"), mat[i].flags); p->writeDWord(cmats[i] + d->OG_job_mats->getOffset("flags"), mat[i].flags);
} }
return true; return true;
} }
@ -610,15 +598,15 @@ bool Creatures::ReadJob(const t_creature * furball, vector<t_material> & mat)
Process * p = d->owner; Process * p = d->owner;
VersionInfo * minfo = d->d->offset_descriptor; 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()); mat.resize(cmats.size());
for(i=0;i<cmats.size();i++) for(i=0;i<cmats.size();i++)
{ {
mat[i].itemType = p->readWord(cmats[i] + minfo->getOffset("job_material_maintype")); mat[i].itemType = p->readWord(cmats[i] + d->OG_job_mats->getOffset("maintype"));
mat[i].subType = p->readWord(cmats[i] + minfo->getOffset("job_material_sectype1")); mat[i].subType = p->readWord(cmats[i] + d->OG_job_mats->getOffset("sectype1"));
mat[i].subIndex = p->readWord(cmats[i] + minfo->getOffset("job_material_sectype2")); mat[i].subIndex = p->readWord(cmats[i] + d->OG_job_mats->getOffset("sectype2"));
mat[i].index = p->readDWord(cmats[i] + minfo->getOffset("job_material_sectype3")); mat[i].index = p->readDWord(cmats[i] + d->OG_job_mats->getOffset("sectype3"));
mat[i].flags = p->readDWord(cmats[i] + minfo->getOffset("job_material_flags")); mat[i].flags = p->readDWord(cmats[i] + d->OG_job_mats->getOffset("flags"));
} }
return true; return true;
} }

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

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

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

@ -27,6 +27,7 @@ distribution.
#include "dfhack/modules/Position.h" #include "dfhack/modules/Position.h"
#include "dfhack/VersionInfo.h" #include "dfhack/VersionInfo.h"
#include "dfhack/DFProcess.h" #include "dfhack/DFProcess.h"
#include "dfhack/DFError.h"
using namespace DFHack; using namespace DFHack;
struct Position::Private struct Position::Private
@ -71,6 +72,8 @@ Position::Position(DFContextShared * d_)
d->cursor_xyz_offset = OG_Position->getAddress ("cursor_xyz"); d->cursor_xyz_offset = OG_Position->getAddress ("cursor_xyz");
d->window_dims_offset = OG_Position->getAddress ("window_dims"); d->window_dims_offset = OG_Position->getAddress ("window_dims");
d->Started = true; d->Started = true;
}
catch(Error::All &){};
try try
{ {
OffsetGroup * OG_Hotkeys = mem->getGroup("Hotkeys"); OffsetGroup * OG_Hotkeys = mem->getGroup("Hotkeys");
@ -80,15 +83,13 @@ Position::Position(DFContextShared * d_)
d->hotkey_size = OG_Hotkeys->getHexValue("size"); d->hotkey_size = OG_Hotkeys->getHexValue("size");
d->StartedHotkeys = true; d->StartedHotkeys = true;
} }
catch(exception &){}; catch(Error::All &){};
try try
{ {
d->screen_tiles_ptr_offset = OG_Position->getAddress ("screen_tiles_pointer"); d->screen_tiles_ptr_offset = OG_Position->getAddress ("screen_tiles_pointer");
d->StartedScreen = true; d->StartedScreen = true;
} }
catch(exception &){}; catch(Error::All &){};
}
catch(exception &){};
} }
Position::~Position() 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/DFProcess.h"
#include "dfhack/VersionInfo.h" #include "dfhack/VersionInfo.h"
#include "dfhack/DFTypes.h" #include "dfhack/DFTypes.h"
#include "dfhack/DFError.h"
using namespace DFHack; using namespace DFHack;
struct World::Private struct World::Private
{ {
bool Inited; bool Inited;
bool Started; bool StartedTime;
bool StartedWeather;
uint32_t year_offset; uint32_t year_offset;
uint32_t tick_offset; uint32_t tick_offset;
uint32_t weather_offset;
DFContextShared *d; DFContextShared *d;
Process * owner; Process * owner;
}; };
@ -59,11 +62,23 @@ World::World(DFContextShared * _d)
d = new Private; d = new Private;
d->d = _d; d->d = _d;
d->owner = _d->p; d->owner = _d->p;
d->Inited = d->StartedTime = d->StartedWeather = false;
OffsetGroup * OG_World = d->d->offset_descriptor->getGroup("World"); OffsetGroup * OG_World = d->d->offset_descriptor->getGroup("World");
try
{
d->year_offset = OG_World->getAddress( "current_year" ); d->year_offset = OG_World->getAddress( "current_year" );
d->tick_offset = OG_World->getAddress( "current_tick" ); d->tick_offset = OG_World->getAddress( "current_tick" );
d->Inited = d->Started = true; 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() World::~World()
@ -83,14 +98,14 @@ bool World::Finish()
uint32_t World::ReadCurrentYear() uint32_t World::ReadCurrentYear()
{ {
if(d->Inited) if(d->Inited && d->StartedTime)
return(d->owner->readDWord(d->year_offset)); return(d->owner->readDWord(d->year_offset));
return 0; return 0;
} }
uint32_t World::ReadCurrentTick() uint32_t World::ReadCurrentTick()
{ {
if(d->Inited) if(d->Inited && d->StartedTime)
return(d->owner->readDWord(d->tick_offset)); return(d->owner->readDWord(d->tick_offset));
return 0; return 0;
} }
@ -114,3 +129,26 @@ uint32_t World::ReadCurrentDay()
{ {
return ((this->ReadCurrentTick() / 1200) % 28) + 1; 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);
}
}

@ -100,6 +100,28 @@ int World_ReadCurrentDay(DFHackObject* world, uint32_t* day)
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 #ifdef __cplusplus
} }
#endif #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) void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
{ {
uint32_t dayoflife; 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].tile_character
<< "," << Materials->raceEx[creature.race].tilecolor.fore << "," << Materials->raceEx[creature.race].tilecolor.fore
<< "," << Materials->raceEx[creature.race].tilecolor.back << "," << Materials->raceEx[creature.race].tilecolor.back
@ -172,7 +172,7 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
if(creature.civ) if(creature.civ)
{ {
cout << "civilization: " << creature.civ; cout << ", civilization: " << creature.civ;
addendl = true; addendl = true;
} }
@ -191,7 +191,7 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
cout << endl; cout << endl;
addendl = false; 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]) 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) ) if( Creatures->ReadInventoryPtr(creature.origin, inventory) )
{ {
DFHack::Items * Items = DF->getItems(); 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()); printf("\t\t%s\n", Items->getItemDescription(inventory[i], Materials).c_str());
} }
} }
*/
/* /*
if(creature.pregnancy_timer > 0) if(creature.pregnancy_timer > 0)
@ -451,7 +453,13 @@ int main (int numargs, char ** args)
} }
mem = DF->getMemoryInfo(); mem = DF->getMemoryInfo();
Materials->ReadAllMaterials(); Materials->ReadInorganicMaterials();
Materials->ReadOrganicMaterials();
Materials->ReadWoodMaterials();
Materials->ReadPlantMaterials();
Materials->ReadCreatureTypes();
Materials->ReadCreatureTypesEx();
Materials->ReadDescriptorColors();
if(!Tran->Start()) if(!Tran->Start())
{ {

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

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

@ -6,6 +6,7 @@
using namespace std; using namespace std;
#include <DFHack.h> #include <DFHack.h>
#include <dfhack/modules/Gui.h>
struct hideblock struct hideblock
{ {
@ -37,6 +38,19 @@ int main (void)
} }
DFHack::Maps *Maps =DF->getMaps(); 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 // init the map
if(!Maps->Start()) if(!Maps->Start())
{ {
@ -47,10 +61,11 @@ int main (void)
return 1; return 1;
} }
cout << "Revealing, please wait..." << endl;
Maps->getSize(x_max,y_max,z_max); Maps->getSize(x_max,y_max,z_max);
vector <hideblock> hidesaved; 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 x = 0; x< x_max;x++)
{ {
for(uint32_t y = 0; y< y_max;y++) for(uint32_t y = 0; y< y_max;y++)
@ -80,8 +95,10 @@ int main (void)
} }
// FIXME: force game pause here! // FIXME: force game pause here!
DF->Detach(); DF->Detach();
cout << "Map revealed. Close window/force exit to keep it that way." << endl; cout << "Map revealed. The game has been paused for you." << endl;
cout << "Press any key to unreveal. Don't close DF or unpause in that case!" << 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(); cin.ignore();
cout << "Unrevealing... please wait." << endl; cout << "Unrevealing... please wait." << endl;
// FIXME: do some consistency checks here! // FIXME: do some consistency checks here!

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