aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index cfa8502..a6963f1 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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);