aboutsummaryrefslogtreecommitdiff
path: root/world.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'world.cpp')
-rw-r--r--world.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/world.cpp b/world.cpp
index bc08f9d..63ba3c1 100644
--- a/world.cpp
+++ b/world.cpp
@@ -270,6 +270,20 @@ Robot& World::createInFront(const Robot *caller,const Team *team,int iset,int nb
return *r;
}
+void World::removeRobot(const Robot *r){
+ *botptr(r)=nullptr;
+}
+
+void World::removeTeam(const Team *team){
+ for(int y=0;y<SIZE;y++){
+ for(int x=0;x<SIZE;x++){
+ if(board[y][x]&&board[y][x]->team==team){
+ board[y][x]=nullptr;
+ }
+ }
+ }
+}
+
void World::tick(){
for(int y=0;y<SIZE;y++){
for(int x=0;x<SIZE;x++){
@@ -299,6 +313,15 @@ void World::tick(){
}
}
+Robot** World::botptr(const Robot *r){
+ for(int y=0;y<SIZE;y++){
+ for(int x=0;x<SIZE;x++){
+ if(board[y][x]==r)return &board[y][x];
+ }
+ }
+ assert(false);
+}
+
Robot** World::targetbotptr(const Robot *r){
for(int y=0;y<SIZE;y++){
for(int x=0;x<SIZE;x++){