diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-03-01 22:43:42 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-03-01 22:43:42 +0100 |
commit | 6149ed650b00dde6b91679880ce8cec66c729f8c (patch) | |
tree | 5dad0820445c4698938012975530b56f0e0c9711 | |
parent | 06afce8c3beb824e9c3d54320c10d1c26448c54d (diff) |
Fix bugs
-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); } |