|
|
|
@ -14,6 +14,7 @@ using std::vector;
|
|
|
|
|
using std::string;
|
|
|
|
|
using std::stack;
|
|
|
|
|
using namespace DFHack;
|
|
|
|
|
using namespace df::enums;
|
|
|
|
|
|
|
|
|
|
DFhackCExport command_result vdig (Core * c, vector <string> & parameters);
|
|
|
|
|
DFhackCExport command_result vdigx (Core * c, vector <string> & parameters);
|
|
|
|
@ -107,7 +108,7 @@ bool dig (MapExtras::MapCache & MCache,
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(isFloorTerrain(tt)
|
|
|
|
|
&& (type == df::tile_dig_designation::DownStair || type == df::tile_dig_designation::Channel)
|
|
|
|
|
&& (type == tile_dig_designation::DownStair || type == tile_dig_designation::Channel)
|
|
|
|
|
&& ts != TREE_OK
|
|
|
|
|
&& ts != TREE_DEAD
|
|
|
|
|
)
|
|
|
|
@ -115,7 +116,7 @@ bool dig (MapExtras::MapCache & MCache,
|
|
|
|
|
std::cerr << "allowing tt" << tt << ", is floor\n";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(isStairTerrain(tt) && type == df::tile_dig_designation::Channel )
|
|
|
|
|
if(isStairTerrain(tt) && type == tile_dig_designation::Channel )
|
|
|
|
|
break;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -124,25 +125,25 @@ bool dig (MapExtras::MapCache & MCache,
|
|
|
|
|
switch(what)
|
|
|
|
|
{
|
|
|
|
|
case circle_set:
|
|
|
|
|
if(des.bits.dig == df::tile_dig_designation::No)
|
|
|
|
|
if(des.bits.dig == tile_dig_designation::No)
|
|
|
|
|
{
|
|
|
|
|
des.bits.dig = type;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case circle_unset:
|
|
|
|
|
if (des.bits.dig != df::tile_dig_designation::No)
|
|
|
|
|
if (des.bits.dig != tile_dig_designation::No)
|
|
|
|
|
{
|
|
|
|
|
des.bits.dig = df::tile_dig_designation::No;
|
|
|
|
|
des.bits.dig = tile_dig_designation::No;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case circle_invert:
|
|
|
|
|
if(des.bits.dig == df::tile_dig_designation::No)
|
|
|
|
|
if(des.bits.dig == tile_dig_designation::No)
|
|
|
|
|
{
|
|
|
|
|
des.bits.dig = type;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
des.bits.dig = df::tile_dig_designation::No;
|
|
|
|
|
des.bits.dig = tile_dig_designation::No;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -183,7 +184,7 @@ DFhackCExport command_result digcircle (Core * c, vector <string> & parameters)
|
|
|
|
|
{
|
|
|
|
|
static bool filled = false;
|
|
|
|
|
static circle_what what = circle_set;
|
|
|
|
|
static df::tile_dig_designation type = df::tile_dig_designation::Default;
|
|
|
|
|
static df::tile_dig_designation type = tile_dig_designation::Default;
|
|
|
|
|
static int diameter = 0;
|
|
|
|
|
auto saved_d = diameter;
|
|
|
|
|
bool force_help = false;
|
|
|
|
@ -215,27 +216,27 @@ DFhackCExport command_result digcircle (Core * c, vector <string> & parameters)
|
|
|
|
|
}
|
|
|
|
|
else if(parameters[i] == "dig")
|
|
|
|
|
{
|
|
|
|
|
type = df::tile_dig_designation::Default;
|
|
|
|
|
type = tile_dig_designation::Default;
|
|
|
|
|
}
|
|
|
|
|
else if(parameters[i] == "ramp")
|
|
|
|
|
{
|
|
|
|
|
type = df::tile_dig_designation::Ramp;
|
|
|
|
|
type = tile_dig_designation::Ramp;
|
|
|
|
|
}
|
|
|
|
|
else if(parameters[i] == "dstair")
|
|
|
|
|
{
|
|
|
|
|
type = df::tile_dig_designation::DownStair;
|
|
|
|
|
type = tile_dig_designation::DownStair;
|
|
|
|
|
}
|
|
|
|
|
else if(parameters[i] == "ustair")
|
|
|
|
|
{
|
|
|
|
|
type = df::tile_dig_designation::UpStair;
|
|
|
|
|
type = tile_dig_designation::UpStair;
|
|
|
|
|
}
|
|
|
|
|
else if(parameters[i] == "xstair")
|
|
|
|
|
{
|
|
|
|
|
type = df::tile_dig_designation::UpDownStair;
|
|
|
|
|
type = tile_dig_designation::UpDownStair;
|
|
|
|
|
}
|
|
|
|
|
else if(parameters[i] == "chan")
|
|
|
|
|
{
|
|
|
|
|
type = df::tile_dig_designation::Channel;
|
|
|
|
|
type = tile_dig_designation::Channel;
|
|
|
|
|
}
|
|
|
|
|
else if (!from_string(diameter,parameters[i], std::dec))
|
|
|
|
|
{
|
|
|
|
@ -246,7 +247,8 @@ DFhackCExport command_result digcircle (Core * c, vector <string> & parameters)
|
|
|
|
|
diameter = -diameter;
|
|
|
|
|
if(force_help || diameter == 0)
|
|
|
|
|
{
|
|
|
|
|
c->con.print( "A command for easy designation of filled and hollow circles.\n"
|
|
|
|
|
c->con.print(
|
|
|
|
|
"A command for easy designation of filled and hollow circles.\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"Options:\n"
|
|
|
|
|
" hollow = Set the circle to hollow (default)\n"
|
|
|
|
@ -273,12 +275,11 @@ DFhackCExport command_result digcircle (Core * c, vector <string> & parameters)
|
|
|
|
|
return CR_OK;
|
|
|
|
|
}
|
|
|
|
|
int32_t cx, cy, cz;
|
|
|
|
|
c->Suspend();
|
|
|
|
|
CoreSuspender suspend(c);
|
|
|
|
|
Gui * gui = c->getGui();
|
|
|
|
|
if (!Maps::IsValid())
|
|
|
|
|
{
|
|
|
|
|
c->con.printerr("Map is not available!\n");
|
|
|
|
|
c->Resume();
|
|
|
|
|
return CR_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -288,7 +289,6 @@ DFhackCExport command_result digcircle (Core * c, vector <string> & parameters)
|
|
|
|
|
MapExtras::MapCache MCache;
|
|
|
|
|
if(!gui->getCursorCoords(cx,cy,cz) || cx == -30000)
|
|
|
|
|
{
|
|
|
|
|
c->Resume();
|
|
|
|
|
c->con.printerr("Can't get the cursor coords...\n");
|
|
|
|
|
return CR_FAILURE;
|
|
|
|
|
}
|
|
|
|
@ -359,7 +359,6 @@ DFhackCExport command_result digcircle (Core * c, vector <string> & parameters)
|
|
|
|
|
lastwhole = whole;
|
|
|
|
|
}
|
|
|
|
|
MCache.WriteAll();
|
|
|
|
|
c->Resume();
|
|
|
|
|
return CR_OK;
|
|
|
|
|
}
|
|
|
|
|
typedef char digmask[16][16];
|
|
|
|
@ -756,25 +755,25 @@ bool stamp_pattern (uint32_t bx, uint32_t by, int z_level,
|
|
|
|
|
continue;
|
|
|
|
|
if(how == EXPLO_CLEAR)
|
|
|
|
|
{
|
|
|
|
|
des.bits.dig = df::tile_dig_designation::No;
|
|
|
|
|
des.bits.dig = tile_dig_designation::No;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(dm[y][x])
|
|
|
|
|
{
|
|
|
|
|
if(what == EXPLO_ALL
|
|
|
|
|
|| des.bits.dig == df::tile_dig_designation::Default && what == EXPLO_DESIGNATED
|
|
|
|
|
|| des.bits.dig == tile_dig_designation::Default && what == EXPLO_DESIGNATED
|
|
|
|
|
|| des.bits.hidden && what == EXPLO_HIDDEN)
|
|
|
|
|
{
|
|
|
|
|
des.bits.dig = df::tile_dig_designation::Default;
|
|
|
|
|
des.bits.dig = tile_dig_designation::Default;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(what == EXPLO_DESIGNATED)
|
|
|
|
|
{
|
|
|
|
|
des.bits.dig = df::tile_dig_designation::No;
|
|
|
|
|
des.bits.dig = tile_dig_designation::No;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bl->flags.set(df::block_flags::Designated);
|
|
|
|
|
bl->flags.set(block_flags::Designated);
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -828,7 +827,8 @@ DFhackCExport command_result expdig (Core * c, vector <string> & parameters)
|
|
|
|
|
}
|
|
|
|
|
if(force_help || how == EXPLO_NOTHING)
|
|
|
|
|
{
|
|
|
|
|
c->con.print("This command can be used for exploratory mining.\n"
|
|
|
|
|
c->con.print(
|
|
|
|
|
"This command can be used for exploratory mining.\n"
|
|
|
|
|
"http://df.magmawiki.com/index.php/DF2010:Exploratory_mining\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"There are two variables that can be set: pattern and filter.\n"
|
|
|
|
@ -850,20 +850,18 @@ DFhackCExport command_result expdig (Core * c, vector <string> & parameters)
|
|
|
|
|
);
|
|
|
|
|
return CR_OK;
|
|
|
|
|
}
|
|
|
|
|
c->Suspend();
|
|
|
|
|
CoreSuspender suspend(c);
|
|
|
|
|
Gui * gui = c->getGui();
|
|
|
|
|
uint32_t x_max, y_max, z_max;
|
|
|
|
|
if (!Maps::IsValid())
|
|
|
|
|
{
|
|
|
|
|
c->con.printerr("Map is not available!\n");
|
|
|
|
|
c->Resume();
|
|
|
|
|
return CR_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
Maps::getSize(x_max,y_max,z_max);
|
|
|
|
|
int32_t xzzz,yzzz,z_level;
|
|
|
|
|
if(!gui->getViewCoords(xzzz,yzzz,z_level))
|
|
|
|
|
{
|
|
|
|
|
c->Resume();
|
|
|
|
|
c->con.printerr("Can't get view coords...\n");
|
|
|
|
|
return CR_FAILURE;
|
|
|
|
|
}
|
|
|
|
@ -939,7 +937,7 @@ DFhackCExport command_result expdig (Core * c, vector <string> & parameters)
|
|
|
|
|
continue;
|
|
|
|
|
if(cross[y][x])
|
|
|
|
|
{
|
|
|
|
|
des.bits.dig = df::tile_dig_designation::Default;
|
|
|
|
|
des.bits.dig = tile_dig_designation::Default;
|
|
|
|
|
mx.setDesignationAt(pos,des);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -953,7 +951,6 @@ DFhackCExport command_result expdig (Core * c, vector <string> & parameters)
|
|
|
|
|
how, what, x_max, y_max);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
c->Resume();
|
|
|
|
|
return CR_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1090,32 +1087,32 @@ DFhackCExport command_result vdig (Core * c, vector <string> & parameters)
|
|
|
|
|
{
|
|
|
|
|
flood.push(current-1);
|
|
|
|
|
|
|
|
|
|
if(des_minus.bits.dig == df::tile_dig_designation::DownStair)
|
|
|
|
|
des_minus.bits.dig = df::tile_dig_designation::UpDownStair;
|
|
|
|
|
if(des_minus.bits.dig == tile_dig_designation::DownStair)
|
|
|
|
|
des_minus.bits.dig = tile_dig_designation::UpDownStair;
|
|
|
|
|
else
|
|
|
|
|
des_minus.bits.dig = df::tile_dig_designation::UpStair;
|
|
|
|
|
des_minus.bits.dig = tile_dig_designation::UpStair;
|
|
|
|
|
MCache->setDesignationAt(current-1,des_minus);
|
|
|
|
|
|
|
|
|
|
des.bits.dig = df::tile_dig_designation::DownStair;
|
|
|
|
|
des.bits.dig = tile_dig_designation::DownStair;
|
|
|
|
|
}
|
|
|
|
|
if(current.z < z_max - 1 && above && vmat_plus == vmat2)
|
|
|
|
|
{
|
|
|
|
|
flood.push(current+ 1);
|
|
|
|
|
|
|
|
|
|
if(des_plus.bits.dig == df::tile_dig_designation::UpStair)
|
|
|
|
|
des_plus.bits.dig = df::tile_dig_designation::UpDownStair;
|
|
|
|
|
if(des_plus.bits.dig == tile_dig_designation::UpStair)
|
|
|
|
|
des_plus.bits.dig = tile_dig_designation::UpDownStair;
|
|
|
|
|
else
|
|
|
|
|
des_plus.bits.dig = df::tile_dig_designation::DownStair;
|
|
|
|
|
des_plus.bits.dig = tile_dig_designation::DownStair;
|
|
|
|
|
MCache->setDesignationAt(current+1,des_plus);
|
|
|
|
|
|
|
|
|
|
if(des.bits.dig == df::tile_dig_designation::DownStair)
|
|
|
|
|
des.bits.dig = df::tile_dig_designation::UpDownStair;
|
|
|
|
|
if(des.bits.dig == tile_dig_designation::DownStair)
|
|
|
|
|
des.bits.dig = tile_dig_designation::UpDownStair;
|
|
|
|
|
else
|
|
|
|
|
des.bits.dig = df::tile_dig_designation::UpStair;
|
|
|
|
|
des.bits.dig = tile_dig_designation::UpStair;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(des.bits.dig == df::tile_dig_designation::No)
|
|
|
|
|
des.bits.dig = df::tile_dig_designation::Default;
|
|
|
|
|
if(des.bits.dig == tile_dig_designation::No)
|
|
|
|
|
des.bits.dig = tile_dig_designation::Default;
|
|
|
|
|
MCache->setDesignationAt(current,des);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|