MCPcopy Create free account
hub / github.com/DFHack/dfhack / digtype

Function digtype

plugins/dig.cpp:1798–1932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1796}
1797
1798command_result digtype (color_ostream &out, vector <string> & parameters)
1799{
1800 //mostly copy-pasted from digv
1801 int32_t priority = parse_priority(out, parameters);
1802
1803 if (!Maps::IsValid())
1804 {
1805 out.printerr("Map is not available!\n");
1806 return CR_FAILURE;
1807 }
1808
1809 uint32_t zMin = 0;
1810 uint32_t xMax,yMax,zMax;
1811 Maps::getSize(xMax,yMax,zMax);
1812
1813 bool hidden = false;
1814 bool automine = true;
1815
1816 int32_t targetDigType = -1;
1817 for (string parameter : parameters) {
1818 if ( parameter == "clear" )
1819 targetDigType = tile_dig_designation::No;
1820 else if ( parameter == "dig" )
1821 targetDigType = tile_dig_designation::Default;
1822 else if ( parameter == "updown" )
1823 targetDigType = tile_dig_designation::UpDownStair;
1824 else if ( parameter == "channel" )
1825 targetDigType = tile_dig_designation::Channel;
1826 else if ( parameter == "ramp" )
1827 targetDigType = tile_dig_designation::Ramp;
1828 else if ( parameter == "down" )
1829 targetDigType = tile_dig_designation::DownStair;
1830 else if ( parameter == "up" )
1831 targetDigType = tile_dig_designation::UpStair;
1832 else if ( parameter == "-z" || parameter == "--cur-zlevel" )
1833 {zMax = *window_z + 1; zMin = *window_z;}
1834 else if ( parameter == "--zdown" || parameter == "-d")
1835 zMax = *window_z + 1;
1836 else if ( parameter == "--zup" || parameter == "-u")
1837 zMin = *window_z;
1838 else if ( parameter == "--hidden" || parameter == "-h")
1839 hidden = true;
1840 else if ( parameter == "--no-auto" || parameter == "-a" )
1841 automine = false;
1842 else
1843 {
1844 out.printerr("Invalid parameter: '{}'.\n", parameter);
1845 return CR_FAILURE;
1846 }
1847 }
1848
1849 int32_t cx, cy, cz;
1850 uint32_t tileXMax = xMax * 16;
1851 uint32_t tileYMax = yMax * 16;
1852 Gui::getCursorCoords(cx,cy,cz);
1853 if (cx == -30000)
1854 {
1855 out.printerr("Cursor is not active. Point the cursor at a vein.\n");

Callers

nothing calls this directly

Calls 7

parse_priorityFunction · 0.85
isWallTerrainFunction · 0.85
tileMaterialFunction · 0.85
tiletypeAtMethod · 0.80
setDesignationAtMethod · 0.80
WriteAllMethod · 0.80
printMethod · 0.45

Tested by

no test coverage detected