added a +z option to digtype

develop
Najeeb Al-Shabibi 2023-09-22 12:41:41 +01:00
parent b7fcf035bc
commit 2083bab2e9
2 changed files with 9 additions and 4 deletions

@ -143,9 +143,10 @@ Designation options:
``clear`` ``clear``
Clear any designations. Clear any designations.
You can also pass a ``-z`` option, which restricts designations to the current You can also pass a ``-z`` and/or a ``+z``` option, which restricts designations to the
z-level and down. This is useful when you don't want to designate tiles on the current z-level and down/up. This is useful when you don't want to designate tiles on the
same z-levels as your carefully dug fort above. same z-levels as your carefully dug fort above/below. To dig only at the current z-level,
pass in both.
digexp digexp
------ ------

@ -1424,6 +1424,8 @@ command_result digtype (color_ostream &out, vector <string> & parameters)
uint32_t xMax,yMax,zMax; uint32_t xMax,yMax,zMax;
Maps::getSize(xMax,yMax,zMax); Maps::getSize(xMax,yMax,zMax);
uint32_t zMin = 0;
int32_t targetDigType = -1; int32_t targetDigType = -1;
for (string parameter : parameters) { for (string parameter : parameters) {
if ( parameter == "clear" ) if ( parameter == "clear" )
@ -1442,6 +1444,8 @@ command_result digtype (color_ostream &out, vector <string> & parameters)
targetDigType = tile_dig_designation::UpStair; targetDigType = tile_dig_designation::UpStair;
else if ( parameter == "-z" ) else if ( parameter == "-z" )
zMax = *window_z + 1; zMax = *window_z + 1;
else if ( parameter == "+z")
zMin = *window_z;
else else
{ {
out.printerr("Invalid parameter: '%s'.\n", parameter.c_str()); out.printerr("Invalid parameter: '%s'.\n", parameter.c_str());
@ -1494,7 +1498,7 @@ command_result digtype (color_ostream &out, vector <string> & parameters)
if (baseDes.bits.dig == tile_dig_designation::Default) baseOcc.bits.dig_auto = true; if (baseDes.bits.dig == tile_dig_designation::Default) baseOcc.bits.dig_auto = true;
else baseOcc.bits.dig_auto = false; else baseOcc.bits.dig_auto = false;
for( uint32_t z = 0; z < zMax; z++ ) for( uint32_t z = zMin; z < zMax; z++ )
{ {
for( uint32_t x = 1; x < tileXMax-1; x++ ) for( uint32_t x = 1; x < tileXMax-1; x++ )
{ {