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