diff options
author | SemperVinco <w.deweijer@hotmail.com> | 2017-03-01 22:24:57 +0100 |
---|---|---|
committer | SemperVinco <w.deweijer@hotmail.com> | 2017-03-01 22:24:57 +0100 |
commit | 0bf7fd38aea996a381717fe4be09817259575531 (patch) | |
tree | 65c76252bb4b42402ca7ff0eb103573b542b0347 /world.cpp | |
parent | 2148f4e5d4effa5d1613a074f91da2c34ac6e5ed (diff) |
Add position argument option -p which places bots in specific locations, syntax: ./sim -p b1.rob 1 2 b2.rob -2 4
Diffstat (limited to 'world.cpp')
-rw-r--r-- | world.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -234,6 +234,14 @@ Robot& World::create(const Team *team,int iset,int nbanks,bool mobile){ y=rand()%SIZE; if(!board[y][x])break; } + + return create(team, iset, nbanks, mobile, x, y); +} + +Robot& World::create(const Team *team,int iset,int nbanks,bool mobile,int x,int y){ + x = (x%SIZE + SIZE)%SIZE; // Negative values are wrapped + y = (y%SIZE + SIZE)%SIZE; + assert(!board[y][x]); board[y][x]=new Robot(); board[y][x]->team=team; board[y][x]->banks.resize(nbanks); |