From d1d9fb006a66822f994e2fa4a46b28e94303c7c7 Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Mon, 7 Mar 2022 15:29:27 +0100 Subject: [PATCH] Proper win when circles can not move --- game.lua | 2 +- objects/grid.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/game.lua b/game.lua index 27039d8..9c10882 100644 --- a/game.lua +++ b/game.lua @@ -224,7 +224,7 @@ end function Game:MouseCallback(x,y,presses) local i for i=1,#self.gameloop do - self.gameloop[i]:MouseCallback(x,y,presses) + if self.gameloop[i]~=nil then self.gameloop[i]:MouseCallback(x,y,presses) end end end diff --git a/objects/grid.lua b/objects/grid.lua index f776a9c..5114ca9 100644 --- a/objects/grid.lua +++ b/objects/grid.lua @@ -51,11 +51,11 @@ function gridgen:new(game,x,y,cellsize) local i local obj = self.game:findName(color) for i=1,#obj do - count = count + #obj[i]:findAvailableMoves() + count = count + #obj[i]:findAvailableMoves() end if count==0 then - local win = "blue" - if self.turn < 2 then win = "pink" end + local win = "pink" + if self.turn < 2 then win = "blue" end self:endgame(win) end end