diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-03-04 14:50:30 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-03-04 14:50:30 +0100 |
commit | 59e14944328f237089213410acc90de3b278eb23 (patch) | |
tree | 1e9986247f4ac71507c203e6b6e5d79cf53b90dd /world.cpp | |
parent | a182157c7cbae8e9b3275f58418c84a5648bde2f (diff) |
gui: Remove teams
Diffstat (limited to 'world.cpp')
-rw-r--r-- | world.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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++){ |