From c35cc6eebd6b500acb204b9af167efda500e7801 Mon Sep 17 00:00:00 2001 From: mcmlxxix <> Date: Fri, 17 Sep 2010 14:01:20 +0000 Subject: [PATCH] get rid of that pesky infinite loop --- xtrn/tankbattle/tanks.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xtrn/tankbattle/tanks.js b/xtrn/tankbattle/tanks.js index 43e9100ee8..b9d2e3476d 100644 --- a/xtrn/tankbattle/tanks.js +++ b/xtrn/tankbattle/tanks.js @@ -781,9 +781,10 @@ function playGame(battle) } function moveShot(shot) { - var newPosition=new Coords(0,0); var count=0; - while(count<2) { + while(count<=2) { + count++; + var newPosition=new Coords(0,0); switch(Number(shot.heading)) { case 0: @@ -853,7 +854,7 @@ function playGame(battle) } break; } - if(count == 2) { + if(count > 2) { log("ERROR: infinite loop detected!"); exit(); } -- GitLab