diff --git a/examples/construction_dump.cpp b/examples/construction_dump.cpp index 5ec74edfc..2bbcb4990 100644 --- a/examples/construction_dump.cpp +++ b/examples/construction_dump.cpp @@ -64,7 +64,9 @@ int main (int numargs, const char ** args) string matstr = "unknown"; if(con.mat_type == 0) { - matstr = inorganics[con.mat_idx].id; + if(con.mat_idx != 0xffffffff) + matstr = inorganics[con.mat_idx].id; + else matstr = "inorganic"; } switch(con.type) { diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 61cb2d2d4..de9869f05 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -14,8 +14,8 @@ ADD_EXECUTABLE(dfprospector prospector.cpp) TARGET_LINK_LIBRARIES(dfprospector dfhack) # cleanmap - removes mud, snow, blood and similar stuff from a map. farmers beware -#ADD_EXECUTABLE(dfcleanmap cleanmap.cpp) -#TARGET_LINK_LIBRARIES(dfcleanmap dfhack) +ADD_EXECUTABLE(dfcleanmap cleanmap.cpp) +TARGET_LINK_LIBRARIES(dfcleanmap dfhack) IF(UNIX) # incrementalsearch - a bit like cheat engine, only DF-specific, very basic diff --git a/tools/cleanmap.cpp b/tools/cleanmap.cpp index aca7fc183..8701cea18 100644 --- a/tools/cleanmap.cpp +++ b/tools/cleanmap.cpp @@ -7,13 +7,18 @@ using namespace std; #include #include +#include +#include +#include int main (void) { uint32_t x_max,y_max,z_max; uint32_t num_blocks = 0; uint32_t bytes_read = 0; - DFHack::occupancies40d occupancies; + vector veinVector; + vector IceVeinVector; + vector splatter; DFHack::API DF("Memory.xml"); try @@ -28,9 +33,10 @@ int main (void) #endif return 1; } + DFHack::Maps *Mapz = DF.getMaps(); // init the map - if(!DF.InitMap()) + if(!Mapz->Start()) { cerr << "Can't init map." << endl; #ifndef LINUX_BUILD @@ -39,7 +45,9 @@ int main (void) return 1; } - DF.getSize(x_max,y_max,z_max); + Mapz->getSize(x_max,y_max,z_max); + + uint8_t zeroes [16][16] = {0}; // walk the map for(uint32_t x = 0; x< x_max;x++) @@ -48,8 +56,20 @@ int main (void) { for(uint32_t z = 0; z< z_max;z++) { - if(DF.isValidBlock(x,y,z)) + if(Mapz->isValidBlock(x,y,z)) { + Mapz->ReadVeins(x,y,z,veinVector,IceVeinVector,splatter); + for(uint32_t i = 0; i < splatter.size(); i++) + { + DFHack::t_spattervein & vein = splatter[i]; + if(vein.mat1 > 19) + { + uint32_t addr = vein.address_of; + uint32_t offset = offsetof(DFHack::t_spattervein, intensity); + DF.WriteRaw(addr + offset,sizeof(zeroes),(uint8_t *) zeroes); + } + } + /* // read block designations DF.ReadOccupancy(x,y,z, &occupancies); // change the hidden flag to 0 @@ -59,6 +79,7 @@ int main (void) } // write the designations back DF.WriteOccupancy(x,y,z, &occupancies); + */ } } }