Testing C and C++ version of maps module in dftest.

develop
Petr Mrázek 2010-07-31 23:09:39 +02:00
parent 294855faef
commit 0dba3df485
1 changed files with 27 additions and 0 deletions

@ -8,10 +8,32 @@
using namespace std; using namespace std;
#include <DFHack.h> #include <DFHack.h>
#include <DFHack_C.h>
#include <dfhack-c/DFTypes_C.h>
#include <dfhack-c/DFContext_C.h>
#include <dfhack-c/modules/Maps_C.h>
using namespace DFHack; using namespace DFHack;
int main (int numargs, const char ** args) 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::ContextManager DFMgr("Memory.xml");
DFHack::Context * DF; DFHack::Context * DF;
try try
@ -29,6 +51,11 @@ int main (int numargs, const char ** args)
} }
// DO STUFF HERE // 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 #ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl; cout << "Done. Press any key to continue" << endl;