diff --git a/tools/supported/prospector.cpp b/tools/supported/prospector.cpp new file mode 100644 index 000000000..c4f93a927 --- /dev/null +++ b/tools/supported/prospector.cpp @@ -0,0 +1,437 @@ +// Produces a list of materials available on the map. +// Options: +// -a : show unrevealed tiles +// -p : don't show plants +// -s : don't show slade +// -t : don't show demon temple + +//#include +#include +#include +#include +#include +#include + +using namespace std; +#include +#include +#include +#include + +typedef std::map MatMap; +typedef std::map LevelMap; +typedef std::vector< pair > MatSorter; + +typedef std::vector FeatureList; +typedef std::vector FeatureListPointer; +typedef std::map FeatureMap; +typedef std::vector PlantList; + +bool parseOptions(int argc, char **argv, bool &showHidden, bool &showPlants, + bool &showSlade, bool &showTemple, bool &showLevels) +{ + char c; + xgetopt opt(argc, argv, "apstz"); + opt.opterr = 0; + while ((c = opt()) != -1) + { + switch (c) + { + case 'a': + showHidden = true; + break; + case 'p': + showPlants = false; + break; + case 's': + showSlade = false; + break; + case 't': + showTemple = false; + break; + case 'z': + showLevels = true; + break; + case '?': + switch (opt.optopt) + { + // For when we take arguments + default: + if (isprint(opt.optopt)) + std::cerr << "Unknown option -" << opt.optopt << "!" + << std::endl; + else + std::cerr << "Unknown option character " << (int) opt.optopt << "!" + << std::endl; + } + default: + // Um..... + return false; + } + } + return true; +} + +template