// Hyperbolic Rogue -- commandline options // Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details namespace hr { #if CAP_COMMANDLINE const char *scorefile = "hyperrogue.log"; namespace arg { eLand readland(const string& ss) { if(ss == "II") return laCrossroads2; if(ss == "III") return laCrossroads3; if(ss == "IV") return laCrossroads4; if(ss == "V") return laCrossroads5; for(int l=0; l, version " VER "\n"); #if !NOLICENSE printf("released under GNU General Public License version 2 and thus\n"); printf("comes with absolutely no warranty; see COPYING for details\n"); #endif #ifdef FHS static string sbuf, cbuf; if(getenv("HOME")) { sbuf = getenv("HOME"); sbuf += "/."; sbuf += scorefile; cbuf = getenv("HOME"); cbuf += "/."; cbuf += conffile; scorefile = sbuf.c_str(); conffile = cbuf.c_str(); } #endif } namespace arg { vector argument; int pos; void lshift() { pos++; } void unshift() { pos--; } void shift() { lshift(); if(pos >= isize(argument)) { printf("Missing parameter\n"); exit(1); } } bool nomore() { return pos >= isize(argument); } const string& args() { return argument[pos]; } const char* argcs() { return args().c_str(); } int argi() { return atoi(argcs()); } unsigned arghex() { return strtoll(argcs(), NULL, 16); } ld argf() { return parseld(args()); } bool argis(const string& s) { if(args()[0] == '-' && args()[1] == '-') return args().substr(1) == s; return args() == s; } void init(int argc, char **argv) { for(int i=0; i - fieldpattern: quotient by the given (must be followed by qpar)\n"); printf(" -qpar - fieldpattern: use the given prime instead of 43\n"); printf(" -cs - fieldpattern: set subpath to the given (cannot be followed by qpar)\n"); printf(" -csp - fieldpattern: find the subpath of order (cannot be followed by qpar)\n"); printf(" -S* - toggle Shmup\n"); printf(" -P n - switch Shmup number of players (n=1..7)\n"); printf(" -PM - switch the model index\n"); printf(" -H* - toggle Hardcore\n"); printf(" -T* - toggle Tactical\n"); printf(" -7* - toggle heptagonal mode\n"); printf(" -C* - toggle Chaos mode\n"); printf(" -R* - toggle Random Pattern\n"); printf(" -Y id - enable Yendor, level id\n"); printf(" -D - disable all the special game modes\n"); printf(" -L - list of features\n"); printf(" -debugf 7 - output debugging information to hyperrogue-debug.txt\n"); printf(" -debuge 7 - output debugging information to stderr\n"); printf(" -offline - don't connect to Steam (for Steam versions)\n"); printf(" -I ITEM n - start with n of ITEM (activates cheat and disables ghosts)\n"); printf(" -fix - fix the seed\n"); printf("Toggles: -o0 disables, -o1 enables, -o switches"); printf("Not all options are documented, see hyper.cpp"); exit(0); } else return 1; return 0; } purehookset hooks_config; hookset *hooks_args; namespace arg { int curphase; auto ah = addHook(hooks_args, 0, readCommon); void read(int phase) { curphase = phase; callhooks(hooks_config); while(pos < isize(argument)) { for(auto& h: *hooks_args) { int r = h.second(); if(r == 2) return; if(r == 0) { lshift(); goto cont; } } printf("Unknown option: %s\n", argcs()); exit(3); cont: ; } } } #endif }