2010-03-25 15:29:05 -06:00
|
|
|
// 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)
|
|
|
|
{
|
2010-03-25 15:48:09 -06:00
|
|
|
int32_t x,y,z;
|
|
|
|
DFHack::designations40d designations;
|
2010-03-25 15:29:05 -06:00
|
|
|
|
|
|
|
DFHack::API DF("Memory.xml");
|
2010-03-25 15:53:35 -06:00
|
|
|
|
2010-03-25 15:29:05 -06:00
|
|
|
if(!DF.Attach())
|
|
|
|
{
|
|
|
|
cerr << "DF not found" << endl;
|
|
|
|
return 1;
|
|
|
|
}
|
2010-03-25 16:12:05 -06:00
|
|
|
DF.InitMap();
|
2010-03-25 15:29:05 -06:00
|
|
|
|
2010-03-25 15:53:35 -06:00
|
|
|
if (DF.InitViewAndCursor())
|
|
|
|
{
|
|
|
|
if(DF.getCursorCoords(x,y,z))
|
2010-03-25 16:04:29 -06:00
|
|
|
{
|
2010-03-25 16:12:05 -06:00
|
|
|
cout << "cursor coords: " << x << "/" << y << "/" << z << endl;
|
2010-03-25 16:31:43 -06:00
|
|
|
if(DF.isValidBlock(x/16,y/16,z))
|
2010-03-25 15:53:35 -06:00
|
|
|
{
|
2010-03-25 17:42:07 -06:00
|
|
|
// place the magma
|
|
|
|
DF.ReadDesignations((x/16),(y/16),z, &designations);
|
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;
|
2010-03-25 16:31:43 -06:00
|
|
|
DF.WriteDesignations(x/16,y/16,z, &designations);
|
2010-03-25 17:42:07 -06:00
|
|
|
|
|
|
|
// make the magma flow :)
|
|
|
|
DFHack::t_blockflags bflags;
|
|
|
|
DF.ReadBlockFlags((x/16),(y/16),z,bflags);
|
|
|
|
// 0x00000001 = job-designated
|
|
|
|
// 0x0000000C = run flows? - both bit 3 and 4 required for making magma placed on a glacier flow
|
|
|
|
bflags.bits.liquid_1 = true;
|
|
|
|
bflags.bits.liquid_2 = true;
|
|
|
|
DF.WriteBlockFlags((x/16),(y/16),z,bflags);
|
2010-03-25 15:59:46 -06:00
|
|
|
cout << "Success" << endl;
|
2010-03-25 15:53:35 -06:00
|
|
|
}
|
2010-03-25 16:04:29 -06:00
|
|
|
else
|
|
|
|
cout << "Failure 1" << endl;
|
2010-03-25 15:48:09 -06:00
|
|
|
}
|
2010-03-25 16:04:29 -06:00
|
|
|
else
|
2010-03-25 16:12:05 -06:00
|
|
|
cout << "Failure 2" << endl;
|
2010-03-25 15:48:09 -06:00
|
|
|
}
|
2010-03-25 15:53:35 -06:00
|
|
|
else
|
|
|
|
cout << "Process Failed" << endl;
|
2010-03-25 15:29:05 -06:00
|
|
|
DF.Detach();
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
cout << "Done. Press any key to continue" << endl;
|
|
|
|
cin.ignore();
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|