1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 22:39:53 +00:00

CLI option -PM now accepts names

This commit is contained in:
Zeno Rogue 2019-10-05 13:04:18 +02:00
parent 0b629c7bb2
commit 455985687b

View File

@ -656,6 +656,16 @@ EX namespace models {
} }
#if CAP_COMMANDLINE #if CAP_COMMANDLINE
eModel read_model(const string& ss) {
for(int i=0; i<isize(ginf); i++) {
if(appears(mdinf[i].name_hyperbolic, ss)) return eModel(i);
if(appears(mdinf[i].name_euclidean, ss)) return eModel(i);
if(appears(mdinf[i].name_spherical, ss)) return eModel(i);
}
return eModel(atoi(ss.c_str()));
}
int readArgs() { int readArgs() {
using namespace arg; using namespace arg;
@ -667,7 +677,7 @@ EX namespace models {
PHASEFROM(2); shift_arg_formula(vid.stretch); PHASEFROM(2); shift_arg_formula(vid.stretch);
} }
else if(argis("-PM")) { else if(argis("-PM")) {
PHASEFROM(2); shift(); pmodel = eModel(argi()); PHASEFROM(2); shift(); pmodel = read_model(args());
if(pmodel == mdFormula) { if(pmodel == mdFormula) {
shift(); basic_model = eModel(argi()); shift(); basic_model = eModel(argi());
shift(); formula = args(); shift(); formula = args();