diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-03-03 12:08:37 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-03-03 12:08:37 +0100 |
commit | bae2ab6cab8a0889568d3999954e45aa28bd9b85 (patch) | |
tree | 379d01592bb9eedab636b4acc2956440299107b9 /main.cpp | |
parent | b7676f0712f12a68dcf27715addcfb09e27f5b2b (diff) |
Make sleep time between frames configurable
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -243,7 +243,7 @@ int parseInt(const char *str){ } void usage(char **argv){ - cerr<<"Usage: "<<argv[0]<<" [-r <fname>]* [-p <fname> <x> <y> <heading>]*"<<endl; + cerr<<"Usage: "<<argv[0]<<" [-r <fname>]* [-p <fname> <x> <y> <heading>]* [-s <sleeptime>]"<<endl; } int main(int argc,char **argv){ @@ -255,6 +255,7 @@ int main(int argc,char **argv){ vector<Team> teams; vector<RobotSpec> robotSpecs; + int sleeptime=3000; if(argc<=1){ usage(argv); @@ -289,6 +290,15 @@ int main(int argc,char **argv){ i+=4; break; + case 's': + if(i>=argc-1){ + cerr<<"Expected sleep time after '-s'"<<endl; + return 1; + } + sleeptime=parseInt(argv[i+1]); + i+=1; + break; + default: cerr<<"Unknown switch in '"<<argv[i]<<"'"<<endl; return 1; @@ -317,7 +327,7 @@ int main(int argc,char **argv){ #endif world.print(*sb); for(int i=0;i<C::autoTimeout;i++){ - usleep(3000); + usleep(sleeptime); world.tick(); world.print(*sb); sb->mvprintf(0, SIZE, "step: %5i", i); |