aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-03-14 19:31:44 +0100
committertomsmeding <tom.smeding@gmail.com>2017-03-14 19:32:07 +0100
commit4a271518149cba9522172e408e57a0d75099388e (patch)
tree6b07bbcfacb7c8996774d81142b5bf69911a2698
parentf2fa26e47654a564493ab4d7b5b2f283a16bdc94 (diff)
Check for iset and mobile when executing instrs
-rw-r--r--world.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/world.cpp b/world.cpp
index 63ba3c1..7f78253 100644
--- a/world.cpp
+++ b/world.cpp
@@ -145,6 +145,7 @@ WorldAction Robot::execute(Instruction &ins,World &world){
break;
case ins_t::trans:{
+ assert(iset>=1);
Robot *r=world.targetbot(this);
if(r){
assert(ins.args[0].num>=1&&ins.args[0].num<=(int)banks.size()&&
@@ -167,6 +168,7 @@ WorldAction Robot::execute(Instruction &ins,World &world){
return WorldAction::die;
case ins_t::move:
+ assert(mobile);
if(world.targetbot(this)==nullptr){
action=WorldAction::move;
}
@@ -178,6 +180,7 @@ WorldAction Robot::execute(Instruction &ins,World &world){
break;
case ins_t::scan:{
+ assert(iset>=1);
Robot *r=world.targetbot(this);
uint16_t *v=resolveVar(ins.args[0],world);
if(!v)break;
@@ -191,6 +194,7 @@ WorldAction Robot::execute(Instruction &ins,World &world){
}
case ins_t::create:
+ assert(iset>=2);
if(world.targetbot(this)!=nullptr)break;
assert(ins.args[0].num>=0&&ins.args[0].num<=2);
assert(ins.args[1].num>=0);