From b6cf04444141464cd44a7dcf3f4ea5f6d5e3ff80 Mon Sep 17 00:00:00 2001 From: Gompyn Date: Fri, 5 Mar 2021 16:41:51 +0800 Subject: [PATCH] replace `goto` with `repeat...until` in cold-clear --- parts/ai.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/parts/ai.lua b/parts/ai.lua index 00d946e3..786a3a06 100644 --- a/parts/ai.lua +++ b/parts/ai.lua @@ -281,9 +281,11 @@ return{ if not pcall(CC.think,P.AI_bot)then break end --Poll keys - ::AGAIN:: - YIELD() - local success,result,dest,hold,move=pcall(CC.getMove,P.AI_bot) + local success,result,dest,hold,move + repeat + YIELD() + success,result,dest,hold,move=pcall(CC.getMove,P.AI_bot) + until not success or result == 0 or result == 2 if not success then break end if result==2 then ins(keys,6) @@ -304,9 +306,6 @@ return{ end end ins(keys,6) - else - --Stay this stage until get keys - goto AGAIN end --Check if time to change target