diff --git a/examples/creaturedump.cpp b/examples/creaturedump.cpp index 7804e1b14..c049d9635 100644 --- a/examples/creaturedump.cpp +++ b/examples/creaturedump.cpp @@ -150,7 +150,7 @@ likeType printLike(DFHack::t_like like, const matGlosses & mat,const vector< vec void printCreature(DFHack::API & DF, const DFHack::t_creature & creature) { - if(string(creaturestypes[creature.type].id) == "DWARF") + if(string(creaturestypes[creature.type].id) == "DWARF") { cout << "address: " << creature.origin << " creature type: " << creaturestypes[creature.type].id << ", position: " << creature.x << "x " << creature.y << "y "<< creature.z << "z" << endl; bool addendl = false; @@ -210,6 +210,9 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature) { cout << ", squad_leader_id: " << creature.squad_leader_id; } + if(creature.mood != -1){ + cout << ", mood: " << creature.mood << " "; + } cout << ", sex: "; if(creature.sex == 0) { @@ -289,8 +292,13 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature) { cout << "from the underworld, "; } - cout << endl << endl; + cout << endl; + if(creature.flags1.bits.had_mood && (creature.mood == -1 || creature.mood == 8 ) ){ + string artifact_name = DF.TranslateName(creature.artifact_name,englishWords,foreignWords,false); + cout << "artifact: " << artifact_name << endl; + } } + cout << endl; } @@ -337,12 +345,13 @@ int main (void) { DFHack::t_creature temp; DF.ReadCreature(i,temp); + cout << "index " << i << " "; printCreature(DF,temp); } uint32_t currentIdx; DFHack::t_creature currentCreature; DF.getCurrentCursorCreature(currentIdx); - cout << "current creature" << endl; + cout << "current creature at index " << currentIdx << endl; DF.ReadCreature(currentIdx, currentCreature); printCreature(DF,currentCreature); diff --git a/library/DFHackAPI.cpp b/library/DFHackAPI.cpp index 2ae2e2c43..5eacbfaf2 100644 --- a/library/DFHackAPI.cpp +++ b/library/DFHackAPI.cpp @@ -1247,7 +1247,7 @@ bool API::ReadCreature (const int32_t index, t_creature & furball) g_pProcess->read(temp2,sizeof(t_like),(uint8_t *) &furball.likes[i]); } - g_pProcess->readWord (temp + d->creature_mood_offset, furball.mood); + furball.mood = (int16_t) g_pProcess->readWord (temp + d->creature_mood_offset); g_pProcess->readDWord (temp + d->creature_happiness_offset, furball.happiness); diff --git a/library/DFTypes.h b/library/DFTypes.h index d478bcb4a..bc369bb3e 100644 --- a/library/DFTypes.h +++ b/library/DFTypes.h @@ -545,7 +545,7 @@ struct t_creature uint8_t numLikes; t_like likes[32]; t_job current_job; - uint16_t mood; + int16_t mood; uint32_t happiness; uint32_t id; uint32_t agility; diff --git a/output/Memory.xml b/output/Memory.xml index 34999b2f0..efc07d3ef 100644 --- a/output/Memory.xml +++ b/output/Memory.xml @@ -787,6 +787,12 @@ 0x0264 0x0664 0x1D64 + + + 0x0 + 0x1C + 0x38 + 0x1C 0x00 @@ -799,9 +805,11 @@ 0xF2 0xF4 0x1A4 + 0x1F8 0x228 0x2F8 0x2AC + 0x3CC 0x438 0x43C 0x440 @@ -851,7 +859,7 @@ 0x1C 0x20 - 0x38 + 0x00 0x7a 0x100 @@ -1127,7 +1135,7 @@ b1a8ca1f91734eb492b7f54f6823cddb
0x014d1db0
0x014bda18
-
0x014d1404
+
0x014D141C
0x00cd4c3c
0x0165b5a8
0x0094b27c
@@ -1297,7 +1305,7 @@ 193193d8624f2f3f6d9d556fab09b122
0x0151bd00
0x01507968
-
0x0151b354
+
0x0151b36c
0x00d20ed8
0x016a54f8
0x009652a4
@@ -1334,7 +1342,7 @@ 6ea1de36af8e1666bd6478736e298c4c
0x015b7750
0x015a33b8
-
0x015b6da4
+
0x015b6dbc
0x00ddaed8
0x0095f410
0x0095f2b4
@@ -1389,7 +1397,7 @@ 12cc4a3dbb6e6dfd7bc7aee458b9471a
0x015be808
0x015aa470
-
0x015bde5c
+
0x015bde74
0x00de1f54
0x00966430
0x009662b4
@@ -1426,7 +1434,7 @@ de66405f54d98297303d439b3b7aa30e
0x015f3260
0x015deec8
-
0x015f28b4
+
0x015f28cc
0x00e16924
0x0099ae08
0x0099ac88
@@ -1473,7 +1481,7 @@ 13640a273d90af39425b798ae9823757
0x01512898
0x014fe500
-
0x01511eec
+
0x01511f04
0x00d35b68
0x016ac1a0
0x0097a2b8