From 0bf7fd38aea996a381717fe4be09817259575531 Mon Sep 17 00:00:00 2001 From: SemperVinco Date: Wed, 1 Mar 2017 22:24:57 +0100 Subject: Add position argument option -p which places bots in specific locations, syntax: ./sim -p b1.rob 1 2 b2.rob -2 4 --- main.cpp | 25 ++++++++++++++++++++++--- sim.exe | Bin 0 -> 1065189 bytes world.cpp | 8 ++++++++ world.h | 1 + 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 sim.exe diff --git a/main.cpp b/main.cpp index 36f5580..30002a8 100644 --- a/main.cpp +++ b/main.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -215,14 +216,32 @@ int main(int argc,char **argv){ World world; vector teams; - for(int i=1;i> positions; // TODO: use pair? + + int k = 1; // Increase past options; + + if(string(argv[k]) == "-p") { + opt_pos = true; + k++; + } + + for(int i=k;iargc + i += 2; + } } - for(const Team &t : teams){ - Robot &r=world.create(&t,2,t.banks.size(),false); + for(int i=0; iteam=team; board[y][x]->banks.resize(nbanks); diff --git a/world.h b/world.h index 8f17834..90ca74e 100644 --- a/world.h +++ b/world.h @@ -94,6 +94,7 @@ public: ~World(); Robot& create(const Team *team,int iset,int nbanks,bool mobile); + Robot& create(const Team *team,int iset,int nbanks,bool mobile,int x,int y); Robot& createInFront(const Robot *caller,const Team *team,int iset,int nbanks,bool mobile); void tick(); -- cgit v1.2.3-70-g09d2