diff options
-rw-r--r-- | world.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -20,10 +20,14 @@ void Robot::load(int idx,const Script &scr){ 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()); + } waited++; Instruction ins=resolve(world); int dur=calcDuration(ins); - if(dur<waited)return WorldAction::none; + if(waited<dur)return WorldAction::none; waited=0; return execute(ins,world); } |