added option to read level data from file

This commit is contained in:
2024-07-21 00:42:10 -04:00
parent 25477c2cf8
commit 401b5b00b5
14 changed files with 366 additions and 58 deletions

View File

@ -19,7 +19,8 @@ feature proc_args(int argc, char **argv,
std::unique_ptr<cursor> &curse,
std::unique_ptr<input> &in,
std::unique_ptr<output> &out,
std::unique_ptr<RNG> &rng) {
std::unique_ptr<RNG> &rng,
std::ifstream &data) {
feature result = 0;
std::string str;
std::string fn_fin;
@ -37,6 +38,9 @@ feature proc_args(int argc, char **argv,
result |= FEATURE_NCURSES;
} else if (str == "-r") {
if (result & FEATURE_READ_MAP)
return FEATURE_CONFLICT | i;
result |= FEATURE_RAND_MAP;
} else if (str == "-c") {
result |= FEATURE_ENEMIES_CHASE;
@ -56,6 +60,14 @@ feature proc_args(int argc, char **argv,
result |= FEATURE_EXTRA_LEVELS;
} else if (str == "-o") {
result |= FEATURE_WALK_OVER;
} else if (str == "-m") {
if (result & FEATURE_RAND_MAP)
return FEATURE_CONFLICT | i;
result |= FEATURE_READ_MAP;
++i;
str = argv[i];
data.open(str);
} else if (str == "-s") {
++i;
str = argv[i];
@ -172,7 +184,7 @@ void panic_args(feature panic) {
}
const char *ARGS_LIST = "\
-n : Use ncurses for I/O\n\
-n : Use ncurses for I/O\n\
-r : Randomly generate maps\n\
-c : Enemies chase the player (CAUTION: THEY CAN REALLY CHASE!!!)\n\
-d : Enemies can go through doors (CAUTION: DO NOT ENABLE WITH CHASING!)\n\
@ -182,6 +194,7 @@ const char *ARGS_LIST = "\
-e : Enable extra potions and races\n\
-E : Enable extra levels\n\
-o : Allows characters to go over gold and potions\n\
-m [file] : Reads map data from file. CANNOT BE USED WITH -r. DOES NOT PANIC!\n\
-s [seed] : Sets initial seed to seed\n\
-I [file] : Reads commands from file. CANNOT BE USED WITH -n.\n\
-O [file] : Outputs to file. CANNOT BE USED WITH -n.\n\