finished the bulk of game
This commit is contained in:
@ -5,19 +5,20 @@
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "file_input.h"
|
||||
#include "file_output.h"
|
||||
#include "console_input.h"
|
||||
#include "console_output.h"
|
||||
#include "curses_input.h"
|
||||
#include "curses_output.h"
|
||||
|
||||
#include "constants.h"
|
||||
#include "input/file_input.h"
|
||||
#include "display/file_output.h"
|
||||
#include "input/console_input.h"
|
||||
#include "display/console_output.h"
|
||||
#include "input/curses_input.h"
|
||||
#include "display/curses_output.h"
|
||||
#include "rng.h"
|
||||
|
||||
feature proc_args(int argc, char **argv,
|
||||
std::unique_ptr<cursor> &curse,
|
||||
std::unique_ptr<input> &in,
|
||||
std::unique_ptr<display> &out,
|
||||
std::unique_ptr<logger> &log,
|
||||
std::unique_ptr<RNG> &rng) {
|
||||
feature result = 0;
|
||||
std::string str;
|
||||
@ -53,6 +54,8 @@ feature proc_args(int argc, char **argv,
|
||||
result |= FEATURE_EXTRA_STUFF;
|
||||
} else if (str == "-E") {
|
||||
result |= FEATURE_EXTRA_LEVELS;
|
||||
} else if (str == "-o") {
|
||||
result |= FEATURE_WALK_OVER;
|
||||
} else if (str == "-s") {
|
||||
++i;
|
||||
str = argv[i];
|
||||
@ -62,15 +65,6 @@ feature proc_args(int argc, char **argv,
|
||||
|
||||
seed = str;
|
||||
result |= FEATURE_SEED;
|
||||
} else if (str == "-L") {
|
||||
++i;
|
||||
str = argv[i];
|
||||
|
||||
if (!fn_lout.empty() && fn_lout != str)
|
||||
return FEATURE_CONFLICT | i;
|
||||
|
||||
fn_lout = str;
|
||||
result |= FEATURE_LOG;
|
||||
} else if (str == "-I") {
|
||||
++i;
|
||||
str = argv[i];
|
||||
@ -116,15 +110,6 @@ feature proc_args(int argc, char **argv,
|
||||
} else if (!(result & FEATURE_NCURSES))
|
||||
out = std::make_unique<console_output>(std::cout);
|
||||
|
||||
if (result & FEATURE_LOG) {
|
||||
std::ofstream lout(fn_lout);
|
||||
|
||||
if (!lout.good())
|
||||
return FEATURE_PANIC_FILE | FEATURE_LOG;
|
||||
|
||||
log = std::make_unique<logger>(std::move(lout));
|
||||
}
|
||||
|
||||
if (result & FEATURE_NCURSES) {
|
||||
curse = std::make_unique<cursor>();
|
||||
in = std::make_unique<curses_input>(curse.get());
|
||||
@ -167,10 +152,6 @@ void panic_args(feature panic) {
|
||||
cerr << "Cannot open specified output file!" << endl;
|
||||
break;
|
||||
|
||||
case FEATURE_LOG:
|
||||
cerr << "Cannot open specified log file!" << endl;
|
||||
break;
|
||||
|
||||
default:
|
||||
cerr << "Something must have went really, really, wrong..."
|
||||
<< endl;
|
||||
@ -184,20 +165,18 @@ void panic_args(feature panic) {
|
||||
}
|
||||
|
||||
void print_args_list() {
|
||||
|
||||
|
||||
static const char *ARGS_LIST = "-n : Use ncurses for I/O\n\
|
||||
-r : Randomly generate maps\n\
|
||||
-m : Enabled a main menu + options\n\
|
||||
-c : Enemies chase the player (through doors and up stairs)\n\
|
||||
-C : Give things better coloring\n\
|
||||
-i : Enable inventory\n\
|
||||
-i : Enable inventory (player can walk on potions)\n\
|
||||
-t : Enable throw\n\
|
||||
-R : Enable revisiting levels\n\
|
||||
-e : Enable extra potions and races\n\
|
||||
-E : Enable extra levels\n\
|
||||
-o : Allows monsters to go over gold and potions\n\
|
||||
-s [seed] : Sets initial seed to seed\n\
|
||||
-L [file] : Enable logging to file\n\
|
||||
-I [file] : Reads commands from file. CANNOT BE USED WITH -n.\n\
|
||||
-O [file] : Outputs to file. CANNOT BE USED WITH -n.\n\
|
||||
-h/--help : Displays options list (doesn't start a game)";
|
||||
|
Reference in New Issue
Block a user