// 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 typedef std::map MatMap; 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) { char c; opterr = 0; xgetopt opt(argc, argv, "apst"); 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 '?': switch (optopt) { // For when we take arguments default: if (isprint(optopt)) std::cerr << "Unknown option -" << optopt << "!" << std::endl; else std::cerr << "Unknown option character " << (int) optopt << "!" << std::endl; } default: // Um..... return false; } } } template