From a974830d8809e327623f4e1699e9e6fa9e6b56cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 17 Nov 2009 15:38:33 +0000 Subject: [PATCH] missing file --- tools/dfitemdump.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tools/dfitemdump.cpp diff --git a/tools/dfitemdump.cpp b/tools/dfitemdump.cpp new file mode 100644 index 000000000..2fb957bd4 --- /dev/null +++ b/tools/dfitemdump.cpp @@ -0,0 +1,60 @@ +// Item dump + +#include +#include +#include +#include +#include +#include +using namespace std; + +#include +#include + +int main () +{ + + DFHack::API DF ("Memory.xml"); + if(!DF.Attach()) + { + cerr << "DF not found" << endl; + return 1; + } + + + vector buildingtypes; + uint32_t numBuildings = DF.InitReadBuildings(buildingtypes); + DF.InitViewAndCursor(); + cout << "q to quit, anything else to look up items at that location\n"; + while(1) + { + string input; + DF.Resume(); + getline (cin, input); + DF.Suspend(); + uint32_t numItems = DF.InitReadItems(); + if(input == "q") + { + break; + } + int32_t x,y,z; + DF.getCursorCoords(x,y,z); + for(uint32_t i = 0; i < numItems; i++) + { + t_item temp; + DF.ReadItem(i, temp); + if(temp.x == x && temp.y == y && temp.z == z) + { + cout << buildingtypes[temp.type] << " 0x" << hex << temp.origin << endl; + } + } + DF.FinishReadItems(); + } + DF.FinishReadBuildings(); + DF.Detach(); +#ifndef LINUX_BUILD + cout << "Done. Press any key to continue" << endl; + cin.ignore(); +#endif + return 0; +}