diff --git a/dfhack/include/config.h b/dfhack/include/config.h index 070e5f175..7deb6c158 100755 --- a/dfhack/include/config.h +++ b/dfhack/include/config.h @@ -1,6 +1,6 @@ -#ifndef CONFIG_H -#define CONFIG_H - -#define MEMXML_DATA_PATH . - -#endif // CONFIG_H +#ifndef CONFIG_H +#define CONFIG_H + +#define MEMXML_DATA_PATH . + +#endif // CONFIG_H diff --git a/examples/creaturedump.cpp b/examples/creaturedump.cpp index dc2707d27..1fc788e28 100644 --- a/examples/creaturedump.cpp +++ b/examples/creaturedump.cpp @@ -464,10 +464,10 @@ int main (int numargs, char ** args) } mem = DF.getMemoryInfo(); - if(!Materials->ReadInorganicMaterials(mat.metalMat)) - { - cerr << "Can't get the inorganics types." << endl; - return 1; + if(!Materials->ReadInorganicMaterials(mat.metalMat)) + { + cerr << "Can't get the inorganics types." << endl; + return 1; } if(!Materials->ReadCreatureTypesEx(creaturestypes)) { diff --git a/tools/moodump.cpp b/tools/moodump.cpp index a79b8902c..2864cfd70 100644 --- a/tools/moodump.cpp +++ b/tools/moodump.cpp @@ -1,142 +1,142 @@ -#include -#include -#include -#include -#include -using namespace std; - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct matGlosses -{ - vector plantMat; - vector woodMat; - vector stoneMat; - vector metalMat; - vector creatureMat; -}; - -vector creaturestypes; -matGlosses mat; -vector< vector > itemTypes; -DFHack::memory_info *mem; -vector< vector > englishWords; -vector< vector > foreignWords; - -int main (int numargs, char ** args) -{ - DFHack::API DF("Memory.xml"); - DFHack::Process * p; - try - { - DF.Attach(); - } - catch (exception& e) - { - cerr << e.what() << endl; - #ifndef LINUX_BUILD - cin.ignore(); - #endif - return 1; - } - p = DF.getProcess(); - string check = ""; - if(numargs == 2) - check = args[1]; - - DFHack::Creatures * Creatures = DF.getCreatures(); - DFHack::Materials * Materials = DF.getMaterials(); - DFHack::Translation * Tran = DF.getTranslation(); - - uint32_t numCreatures; - if(!Creatures->Start(numCreatures)) - { - cerr << "Can't get creatures" << endl; - #ifndef LINUX_BUILD - cin.ignore(); - #endif - return 1; - } - if(!numCreatures) - { - cerr << "No creatures to print" << endl; - #ifndef LINUX_BUILD - cin.ignore(); - #endif - return 1; - } - mem = DF.getMemoryInfo(); - - if(!Materials->ReadInorganicMaterials(mat.metalMat)) - { - cerr << "Can't get the inorganics types." << endl; - return 1; - } - - if(!Materials->ReadCreatureTypesEx(creaturestypes)) - { - cerr << "Can't get the creature types." << endl; - return 1; - } - - if(!Tran->Start()) - { - cerr << "Can't get name tables" << endl; - return 1; - } - vector addrs; - //DF.InitViewAndCursor(); - for(uint32_t i = 0; i < numCreatures; i++) - { - DFHack::t_creature temp; - unsigned int current_job; - unsigned int mat_start; - unsigned int mat_end; - unsigned int j,k; - unsigned int matptr; - unsigned int tmp; - - Creatures->ReadCreature(i,temp); - if(temp.mood>=0) - { - current_job = p->readDWord(temp.origin + 0x390); - if(current_job == 0) - continue; - mat_start = p->readDWord(current_job + 0xa4 + 4*3); - mat_end = p->readDWord(current_job + 0xa4 + 4*4); - for(j=mat_start;jreadDWord(j); - for(k=0;k<4;k++) - printf("%.4X ", p->readWord(matptr + k*2)); - for(k=0;k<3;k++) - printf("%.8X ", p->readDWord(matptr + k*4 + 0x8)); - for(k=0;k<2;k++) - printf("%.4X ", p->readWord(matptr + k*2 + 0x14)); - for(k=0;k<3;k++) - printf("%.8X ", p->readDWord(matptr + k*4 + 0x18)); - for(k=0;k<4;k++) - printf("%.2X ", p->readByte(matptr + k + 0x24)); - for(k=0;k<6;k++) - printf("%.8X ", p->readDWord(matptr + k*4 + 0x28)); - for(k=0;k<4;k++) - printf("%.2X ", p->readByte(matptr + k + 0x40)); - for(k=0;k<9;k++) - printf("%.8X ", p->readDWord(matptr + k*4 + 0x44)); - printf(" [%p]\n", matptr); - } - } - } - Creatures->Finish(); - DF.Detach(); - return 0; -} - +#include +#include +#include +#include +#include +using namespace std; + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct matGlosses +{ + vector plantMat; + vector woodMat; + vector stoneMat; + vector metalMat; + vector creatureMat; +}; + +vector creaturestypes; +matGlosses mat; +vector< vector > itemTypes; +DFHack::memory_info *mem; +vector< vector > englishWords; +vector< vector > foreignWords; + +int main (int numargs, char ** args) +{ + DFHack::API DF("Memory.xml"); + DFHack::Process * p; + try + { + DF.Attach(); + } + catch (exception& e) + { + cerr << e.what() << endl; + #ifndef LINUX_BUILD + cin.ignore(); + #endif + return 1; + } + p = DF.getProcess(); + string check = ""; + if(numargs == 2) + check = args[1]; + + DFHack::Creatures * Creatures = DF.getCreatures(); + DFHack::Materials * Materials = DF.getMaterials(); + DFHack::Translation * Tran = DF.getTranslation(); + + uint32_t numCreatures; + if(!Creatures->Start(numCreatures)) + { + cerr << "Can't get creatures" << endl; + #ifndef LINUX_BUILD + cin.ignore(); + #endif + return 1; + } + if(!numCreatures) + { + cerr << "No creatures to print" << endl; + #ifndef LINUX_BUILD + cin.ignore(); + #endif + return 1; + } + mem = DF.getMemoryInfo(); + + if(!Materials->ReadInorganicMaterials(mat.metalMat)) + { + cerr << "Can't get the inorganics types." << endl; + return 1; + } + + if(!Materials->ReadCreatureTypesEx(creaturestypes)) + { + cerr << "Can't get the creature types." << endl; + return 1; + } + + if(!Tran->Start()) + { + cerr << "Can't get name tables" << endl; + return 1; + } + vector addrs; + //DF.InitViewAndCursor(); + for(uint32_t i = 0; i < numCreatures; i++) + { + DFHack::t_creature temp; + unsigned int current_job; + unsigned int mat_start; + unsigned int mat_end; + unsigned int j,k; + unsigned int matptr; + unsigned int tmp; + + Creatures->ReadCreature(i,temp); + if(temp.mood>=0) + { + current_job = p->readDWord(temp.origin + 0x390); + if(current_job == 0) + continue; + mat_start = p->readDWord(current_job + 0xa4 + 4*3); + mat_end = p->readDWord(current_job + 0xa4 + 4*4); + for(j=mat_start;jreadDWord(j); + for(k=0;k<4;k++) + printf("%.4X ", p->readWord(matptr + k*2)); + for(k=0;k<3;k++) + printf("%.8X ", p->readDWord(matptr + k*4 + 0x8)); + for(k=0;k<2;k++) + printf("%.4X ", p->readWord(matptr + k*2 + 0x14)); + for(k=0;k<3;k++) + printf("%.8X ", p->readDWord(matptr + k*4 + 0x18)); + for(k=0;k<4;k++) + printf("%.2X ", p->readByte(matptr + k + 0x24)); + for(k=0;k<6;k++) + printf("%.8X ", p->readDWord(matptr + k*4 + 0x28)); + for(k=0;k<4;k++) + printf("%.2X ", p->readByte(matptr + k + 0x40)); + for(k=0;k<9;k++) + printf("%.8X ", p->readDWord(matptr + k*4 + 0x44)); + printf(" [%p]\n", matptr); + } + } + } + Creatures->Finish(); + DF.Detach(); + return 0; +} +