aboutsummaryrefslogtreecommitdiff
path: root/world.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'world.cpp')
-rw-r--r--world.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/world.cpp b/world.cpp
index 86c805e..b1d5e75 100644
--- a/world.cpp
+++ b/world.cpp
@@ -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);