dfhack/tools/reveal.cpp

71 lines
1.6 KiB
C++

2009-09-13 18:02:46 -06:00
// This is a reveal program. It reveals the map.
#include <iostream>
#include <integers.h>
2009-09-13 18:02:46 -06:00
#include <vector>
using namespace std;
#include <DFTypes.h>
#include <DFHackAPI.h>
int main (void)
{
uint32_t x_max,y_max,z_max;
DFHack::designations40d designations;
2009-09-13 18:02:46 -06:00
2009-11-10 20:37:28 -07:00
DFHack::API DF("Memory.xml");
try
2009-09-13 18:02:46 -06:00
{
DF.Attach();
}
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
cin.ignore();
#endif
2009-09-13 18:02:46 -06:00
return 1;
}
// init the map
if(!DF.InitMap())
{
cerr << "Can't init map." << endl;
#ifndef LINUX_BUILD
cin.ignore();
#endif
return 1;
}
2009-09-13 18:02:46 -06:00
DF.getSize(x_max,y_max,z_max);
// walk the map
for(uint32_t x = 0; x< x_max;x++)
{
for(uint32_t y = 0; y< y_max;y++)
{
for(uint32_t z = 0; z< z_max;z++)
{
if(DF.isValidBlock(x,y,z))
{
// read block designations
DF.ReadDesignations(x,y,z, &designations);
2009-09-13 18:02:46 -06:00
// change the hidden flag to 0
for (uint32_t i = 0; i < 16;i++) for (uint32_t j = 0; j < 16;j++)
2009-09-13 18:02:46 -06:00
{
designations[i][j].bits.hidden = 0;
2009-09-13 18:02:46 -06:00
}
// write the designations back
DF.WriteDesignations(x,y,z, &designations);
2009-09-13 18:02:46 -06:00
}
}
}
}
2009-10-31 12:18:59 -06:00
DF.Detach();
#ifndef LINUX_BUILD
2009-10-30 03:01:14 -06:00
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
2009-09-13 18:02:46 -06:00
return 0;
}