dfhack/tools/materialtest.cpp

47 lines
1.0 KiB
C++

2009-11-02 05:53:39 -07:00
// Attach test
// attachtest - 100x attach/detach, 100x reads, 100x writes
#include <iostream>
#include <climits>
#include <integers.h>
#include <vector>
#include <ctime>
using namespace std;
#include <DFTypes.h>
#include <DFHackAPI.h>
int main (void)
{
2009-11-10 20:37:28 -07:00
DFHack::API DF("Memory.xml");
2009-11-02 05:53:39 -07:00
if(!DF.Attach())
{
cerr << "DF not found" << endl;
return 1;
}
2009-12-12 17:47:58 -07:00
vector <DFHack::t_matgloss> Plants;
2009-11-02 05:53:39 -07:00
DF.ReadPlantMatgloss(Plants);
2009-12-12 17:47:58 -07:00
vector <DFHack::t_matgloss> Metals;
2009-11-02 05:53:39 -07:00
DF.ReadMetalMatgloss(Metals);
2009-12-12 17:47:58 -07:00
vector <DFHack::t_matgloss> Stones;
2009-11-02 05:53:39 -07:00
DF.ReadStoneMatgloss(Stones);
2009-12-12 17:47:58 -07:00
vector <DFHack::t_matgloss> CreatureTypes;
2009-11-02 05:53:39 -07:00
DF.ReadCreatureMatgloss(CreatureTypes);
cout << "Plant: " << Plants[0].id << endl;
cout << "Metal: " << Metals[0].id << endl;
cout << "Stone: " << Stones[0].id << endl;
cout << "Creature: " << CreatureTypes[0].id << endl;
DF.Detach();
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
2009-11-02 05:53:39 -07:00
cin.ignore();
#endif
2009-11-02 05:53:39 -07:00
return 0;
}