mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2026-11-28 00:23:08 +00:00
fixed arg shifting
This commit is contained in:
1 parent
38e1dc6a7a
commit
c40d7753d0
4 files changed
+12
-6
No files matched your search
+3
-2
@@ -60,9 +60,10 @@ namespace arg {
|
||||
int pos;
|
||||
|
||||
void lshift() { pos++; }
|
||||
void unshift() { pos--; }
|
||||
|
||||
void shift() {
|
||||
lshift(); if(pos > isize(argument)) { printf("Missing parameter\n"); exit(1); }
|
||||
lshift(); if(pos >= isize(argument)) { printf("Missing parameter\n"); exit(1); }
|
||||
}
|
||||
|
||||
bool nomore() { return pos >= isize(argument); }
|
||||
@@ -74,7 +75,7 @@ namespace arg {
|
||||
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<argc; i++) argument.push_back(argv[i]); shift(); }
|
||||
void init(int argc, char **argv) { for(int i=0; i<argc; i++) argument.push_back(argv[i]); lshift(); }
|
||||
|
||||
void phaseerror(int x) {
|
||||
printf("Command line error: cannot read command '%s' from phase %d in phase %d\n", args().c_str(), x, curphase);
|
||||
|
||||
Reference in new issue
Block a user