From 0dba3df485735b4a7ebfd4680f5c42f78368b558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 31 Jul 2010 23:09:39 +0200 Subject: [PATCH] Testing C and C++ version of maps module in dftest. --- tools/playground/test.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/playground/test.cpp b/tools/playground/test.cpp index e62b35d2a..b67608f9a 100644 --- a/tools/playground/test.cpp +++ b/tools/playground/test.cpp @@ -8,10 +8,32 @@ using namespace std; #include +#include +#include +#include +#include using namespace DFHack; int main (int numargs, const char ** args) { + printf("From C: "); + DFHackObject* cman = ContextManager_Alloc("Memory.xml"); + DFHackObject* context = ContextManager_getSingleContext(cman); + if(context) + { + Context_Attach(context); + DFHackObject * maps = Context_getMaps(context); + if(maps) + { + Maps_Start(maps); + uint32_t x,y,z; + Maps_getSize(maps, &x, &y, &z); + printf("Map size: %d, %d, %d\n", x,y,z); + } + } + ContextManager_Free(cman); + + cout << "From C++:"; DFHack::ContextManager DFMgr("Memory.xml"); DFHack::Context * DF; try @@ -29,6 +51,11 @@ int main (int numargs, const char ** args) } // DO STUFF HERE + Maps * m = DF->getMaps(); + m->Start(); + uint32_t x,y,z; + m->getSize(x,y,z); + cout << "Map size " << x << ", "<< y << ", " << z << endl; #ifndef LINUX_BUILD cout << "Done. Press any key to continue" << endl;