dflair tool to match what the dfusion people have. minor tweaks to playground

develop
Petr Mrázek 2011-03-21 21:14:07 +01:00
parent 7072c43e96
commit e8ee9b7cab
4 changed files with 83 additions and 27 deletions

@ -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

@ -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

@ -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)

@ -0,0 +1,76 @@
// This is a simple bit writer... it marks the whole map as a creature lair, preventing item scatter.
#include <iostream>
#include <vector>
#include <map>
using namespace std;
#include <DFHack.h>
//#include <dfhack/modules/Gui.h>
//#include <dfhack/DFTileTypes.h>
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;
}