Fixed P2 connecting to nobody with skynet

This commit is contained in:
LDDestroier 2018-11-21 12:01:13 -05:00 committed by GitHub
parent 3a5f1128f1
commit 9eecb9f9b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 9 deletions

View File

@ -923,8 +923,6 @@ local game = function()
end end
end end
local decision
local networking = function() local networking = function()
local evt, side, channel, repchannel, msg, distance local evt, side, channel, repchannel, msg, distance
while true do while true do
@ -998,8 +996,10 @@ local helpScreen = function()
waitForKey(0.25) waitForKey(0.25)
end end
local decision
local main = function() local main = function()
local rVal local rVal
while true do while true do
decision = titleScreen() decision = titleScreen()
lockInput = false lockInput = false
@ -1026,16 +1026,17 @@ local main = function()
gameDelay = gameDelayInit, gameDelay = gameDelayInit,
grid = initGrid grid = initGrid
}) })
rVal = parallel.waitForAny(pleaseWait, networking) rVal = parallel.waitForAny( pleaseWait, networking )
-- give time for skynet
sleep(0.1) sleep(0.1)
if rVal == 2 then if rVal == 2 then
startCountdown() startCountdown()
parallel.waitForAny(getInput, game, networking) parallel.waitForAny( getInput, game, networking )
end end
elseif decision == "help" then elseif decision == "help" then
helpScreen() helpScreen()
elseif decision == "demo" then elseif decision == "demo" then
parallel.waitForAny(getInput, gridDemo) parallel.waitForAny( getInput, gridDemo )
elseif decision == "exit" then elseif decision == "exit" then
return cleanExit() return cleanExit()
end end
@ -1044,6 +1045,7 @@ end
if useSkynet then if useSkynet then
parallel.waitForAny(main, skynet.listen) parallel.waitForAny(main, skynet.listen)
skynet.socket.close()
else else
main() main()
end end