Merge branch 'master' of git://github.com/nmlittle/dfhack into test

develop
Petr Mrázek 2010-03-25 23:33:43 +01:00
commit 99760d5ae0
2 changed files with 57 additions and 0 deletions

@ -35,6 +35,9 @@ TARGET_LINK_LIBRARIES(dfdigger dfhack)
ADD_EXECUTABLE(dfitemdesignator itemdesignator.cpp)
TARGET_LINK_LIBRARIES(dfitemdesignator dfhack)
# a magma creation toold
ADD_EXECUTABLE(dfmagma_create magma_create.cpp)
TARGET_LINK_LIBRARIES(dfmagma_create dfhack)
IF(UNIX)
install(TARGETS

@ -0,0 +1,54 @@
// 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");
if(!DF.Attach())
{
cerr << "DF not found" << endl;
return 1;
}
DF.InitMap();
if (DF.InitViewAndCursor())
{
if(DF.getCursorCoords(x,y,z))
{
cout << "cursor coords: " << x << "/" << y << "/" << z << endl;
if(DF.isValidBlock(x/16,y/16,z))
{
DF.ReadDesignations((x/16),(y/16),(z/16), &designations);
designations[x%16][y%16].bits.flow_size = 7;
designations[x%16][y%16].bits.liquid_type = DFHack::liquid_magma;
DF.WriteDesignations(x/16,y/16,z, &designations);
cout << "Success" << endl;
}
else
cout << "Failure 1" << endl;
}
else
cout << "Failure 2" << endl;
}
else
cout << "Process Failed" << endl;
DF.Detach();
#ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
return 0;
}