diff --git a/library/include/dfhack/modules/Maps.h b/library/include/dfhack/modules/Maps.h index e5b4d427b..857b9c274 100644 --- a/library/include/dfhack/modules/Maps.h +++ b/library/include/dfhack/modules/Maps.h @@ -318,32 +318,6 @@ namespace DFHack naked_designation bits; }; - /* - * unsigned int mud : 1; - unsigned int vomit :1;* - unsigned int broken_arrows_color :4; - unsigned int blood_g : 1; - unsigned int blood_g2 : 1; - unsigned int blood_b : 1; - unsigned int blood_b2 : 1; - unsigned int blood_y : 1; - unsigned int blood_y2 : 1; - unsigned int blood_m : 1; - unsigned int blood_m2 : 1; - unsigned int blood_c : 1; - unsigned int blood_c2 : 1; - unsigned int blood_w : 1; - unsigned int blood_w2 : 1; - unsigned int blood_o : 1; - unsigned int blood_o2 : 1; - unsigned int slime : 1; - unsigned int slime2 : 1; - unsigned int blood : 1; - unsigned int blood2 : 1; - unsigned int broken_arrows_variant : 1; - unsigned int snow : 1; - */ - /** * occupancy flags (rat,dwarf,horse,built wall,not build wall,etc) * \ingroup grp_maps diff --git a/tools/playground/CMakeLists.txt b/tools/playground/CMakeLists.txt index 151f64be7..ade13704b 100644 --- a/tools/playground/CMakeLists.txt +++ b/tools/playground/CMakeLists.txt @@ -21,6 +21,7 @@ DFHACK_TOOL(dfmoodump moodump.cpp) # bauxite - turn all mechanisms into bauxite mechanisms # Author: Alex Legg +# FIXME: turned off. there is no reliable Items module. #DFHACK_TOOL(dfbauxite dfbauxite.cpp) # digger - designate for digging by tile class @@ -34,11 +35,13 @@ DFHACK_TOOL(dfdigger2 digger2.cpp) # itemdesignator - change some item designations (dump, forbid, on-fire) for all # items of a given type and material # Author: belal +# FIXME: turned off. there is no reliable Items module. #DFHACK_TOOL(dfitemdesignator itemdesignator.cpp) # catsplosion - Accelerates pregnancy # Author: Zhentar -DFHACK_TOOL(dfcatsplosion catsplosion.cpp) +# FIXME: no longer works due to changes in DF +#DFHACK_TOOL(dfcatsplosion catsplosion.cpp) # findnameindexes # Author: belal diff --git a/tools/supported/CMakeLists.txt b/tools/supported/CMakeLists.txt index e919f1ed5..78c094680 100644 --- a/tools/supported/CMakeLists.txt +++ b/tools/supported/CMakeLists.txt @@ -17,6 +17,9 @@ ENDIF() # a reveal clone DFHACK_TOOL(dfreveal reveal.cpp) +# designate all visible floor tiles as lair, freezing items in place +DFHACK_TOOL(dflair lair.cpp) + # force pause! DFHACK_TOOL(dfpause forcepause.cpp) diff --git a/tools/supported/lair.cpp b/tools/supported/lair.cpp new file mode 100644 index 000000000..592ec977b --- /dev/null +++ b/tools/supported/lair.cpp @@ -0,0 +1,76 @@ +// This is a simple bit writer... it marks the whole map as a creature lair, preventing item scatter. + +#include +#include +#include +using namespace std; +#include +//#include +//#include + +int main (void) +{ + uint32_t x_max,y_max,z_max; + DFHack::occupancies40d occupancies; + //DFHack::tiletypes40d tiles; + + DFHack::ContextManager DFMgr("Memory.xml"); + DFHack::Context *DF; + try + { + DF = DFMgr.getSingleContext(); + DF->Attach(); + } + catch (exception& e) + { + cerr << e.what() << endl; + #ifndef LINUX_BUILD + cin.ignore(); + #endif + return 1; + } + + DFHack::Maps *Maps =DF->getMaps(); + + // init the map + if(!Maps->Start()) + { + cerr << "Can't init map." << endl; + #ifndef LINUX_BUILD + cin.ignore(); + #endif + return 1; + } + + cout << "Designating, please wait..." << endl; + + Maps->getSize(x_max,y_max,z_max); + 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(Maps->isValidBlock(x,y,z)) + { + // read block designations + Maps->ReadOccupancy(x,y,z, &occupancies); + //Maps->ReadTileTypes(x,y,z, &tiles); + // change the monster_lair flag to 1 + for (uint32_t i = 0; i < 16;i++) for (uint32_t j = 0; j < 16;j++) + { + // add tile type chack here + occupancies[i][j].bits.monster_lair = 1; + } + // write the designations back + Maps->WriteOccupancy(x,y,z, &occupancies); + } + } + } + } + #ifndef LINUX_BUILD + cout << "The map has been marked as a creature lair. Items shouldn't scatter." << endl; + cin.ignore(); + #endif + return 0; +}