dfhack/tools/magma_create.cpp

50 lines
1.2 KiB
C++

// This will create 7 deep magama on the square the cursor is on. It does not
// enable magma buildings at this time.
#include <iostream>
#include <integers.h>
#include <vector>
using namespace std;
#include <DFTypes.h>
#include <DFHackAPI.h>
int main (void)
{
int32_t x,y,z;
DFHack::designations40d designations;
DFHack::API DF("Memory.xml");
2010-03-25 15:53:35 -06:00
if(!DF.Attach())
{
cerr << "DF not found" << endl;
return 1;
}
DF.InitMap();
2010-03-25 15:53:35 -06:00
if (DF.InitViewAndCursor())
{
if(DF.getCursorCoords(x,y,z))
{
if(DF.isValidBlock(x,y,z))
{
DF.ReadDesignations((x/16),(y/16),(z/16), &designations);
2010-03-25 15:59:46 -06:00
cout << x%16;
2010-03-25 15:53:35 -06:00
designations[x%16][y%16].bits.flow_size = 7;
designations[x%16][y%16].bits.liquid_type = DFHack::liquid_magma;
DF.WriteDesignations(x,y,z, &designations);
2010-03-25 15:59:46 -06:00
cout << "Success" << endl;
2010-03-25 15:53:35 -06:00
}
}
}
2010-03-25 15:53:35 -06:00
else
cout << "Process Failed" << endl;
DF.Detach();
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
return 0;
}