diff options
-rw-r--r-- | world.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -24,7 +24,7 @@ WorldAction Robot::tick(World &world){ if(active==0)return WorldAction::none; // TODO: check whether `waited` needs to be reset if(!ipInRange()){ ip.bank=ip.pos=0; - assert(ipInRange()); + if(!ipInRange())return WorldAction::die; } waited++; Instruction ins=resolve(world); @@ -259,7 +259,7 @@ Robot& World::create(const Team *team,int iset,int nbanks,bool mobile){ Robot& World::create(const Team *team,int iset,int nbanks,bool mobile,int x,int y,int heading){ x = (x%SIZE + SIZE)%SIZE; // Negative values are wrapped y = (y%SIZE + SIZE)%SIZE; - assert(!board[y][x]); + if(board[y][x])return *board[y][x]; board[y][x]=new Robot(); board[y][x]->team=team; board[y][x]->banks.resize(nbanks); |