dfhack/examples/veccheck.cpp

75 lines
1.7 KiB
C++

2010-03-05 14:19:27 -07:00
// Just show some position data
#include <iostream>
2010-04-07 04:49:37 -06:00
#include <iomanip>
2010-03-05 14:19:27 -07:00
#include <climits>
#include <integers.h>
#include <vector>
#include <sstream>
#include <ctime>
2010-04-06 05:05:54 -06:00
#include <cstdio>
2010-03-05 14:19:27 -07:00
using namespace std;
#include <DFTypes.h>
#include <DFHackAPI.h>
#include <DFProcess.h>
#include <DFMemInfo.h>
2010-04-02 07:47:08 -06:00
#include <DFVector.h>
2010-04-06 05:05:54 -06:00
#include <DFTypes.h>
2010-04-07 04:49:37 -06:00
#include <modules/Materials.h>
#include <modules/Position.h>
2010-04-09 16:24:41 -06:00
#include <modules/Constructions.h>
#include "miscutils.h"
2010-04-07 04:49:37 -06:00
2010-04-07 14:28:05 -06:00
using namespace DFHack;
2010-03-05 14:19:27 -07:00
int main (int numargs, const char ** args)
{
DFHack::API DF("Memory.xml");
try
2010-03-05 14:19:27 -07:00
{
DF.Attach();
2010-03-05 14:19:27 -07:00
}
catch (exception& e)
2010-03-05 14:19:27 -07:00
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
cin.ignore();
2010-03-05 14:19:27 -07:00
#endif
return 1;
2010-03-05 14:19:27 -07:00
}
2010-04-07 14:28:05 -06:00
2010-04-09 16:24:41 -06:00
DFHack::Position *Pos = DF.getPosition();
DFHack::Constructions *Cons = DF.getConstructions();
uint32_t numConstr;
Cons->Start(numConstr);
2010-04-07 14:28:05 -06:00
int32_t cx, cy, cz;
Pos->getCursorCoords(cx,cy,cz);
2010-04-09 16:24:41 -06:00
if(cx != -30000)
2010-04-07 14:28:05 -06:00
{
2010-04-09 16:24:41 -06:00
t_construction con;
for(uint32_t i = 0; i < numConstr; i++)
2010-04-07 14:28:05 -06:00
{
2010-04-09 16:24:41 -06:00
Cons->Read(i,con);
if(cx == con.x && cy == con.y && cz == con.z)
2010-04-07 14:28:05 -06:00
{
2010-04-09 16:24:41 -06:00
printf("Construction %d/%d/%d @ 0x%x - Material %d %d\n", con.x, con.y, con.z,con.origin, con.mat_type, con.mat_idx);
printf("Material form: %d ", con.type);
if(con.type == 4)
2010-04-07 14:28:05 -06:00
{
2010-04-09 16:24:41 -06:00
printf("It is rough.");
2010-04-07 14:28:05 -06:00
}
2010-04-09 16:24:41 -06:00
printf("\n");
hexdump(DF,con.origin,2);
2010-04-07 14:28:05 -06:00
}
}
}
2010-03-05 14:19:27 -07:00
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
return 0;
}