Proper win when circles can not move

This commit is contained in:
theo@manjaro 2022-03-07 15:29:27 +01:00
parent 8b04842eeb
commit d1d9fb006a
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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