Fix two bugs causing multiplayer tests to fail

After finding a game, in some circumstances the join script got the
leader select dialog after only yielding once. Because the loop that
checks when the dialog appears was a repeat-until loop and not a while
loop, it was always run at least once, making the script yield even when
the dialog was already shown. That caused the dialog to close with a
"not shown" status that resulted in exiting the game.

MP tests run two games, not one. A MP wait screen is shown between the
games to the joining player (but not to the host, see
src/game_initialization/playcampaign.cpp:352 ). The join script ended up
quitting between the games. Fixed by simply duplicating code to make the
join script play two games.
This commit is contained in:
Jyrki Vesterinen 2016-08-31 23:42:35 +03:00
parent 446de553bd
commit 6016bdf2f2

View file

@ -93,7 +93,7 @@ local function plugin()
events, context, info = coroutine.yield() events, context, info = coroutine.yield()
repeat while not (info.name == "Dialog" or info.name == "Multiplayer Wait") do
if context.join then if context.join then
context.join({}) context.join({})
else else
@ -102,7 +102,7 @@ local function plugin()
events, context, info = coroutine.yield() events, context, info = coroutine.yield()
idle_text("in " .. info.name .. " waiting for leader select dialog") idle_text("in " .. info.name .. " waiting for leader select dialog")
until info.name == "Dialog" or info.name == "Multiplayer Wait" end
if info.name == "Dialog" then if info.name == "Dialog" then
log("got a leader select dialog...") log("got a leader select dialog...")
@ -130,6 +130,16 @@ local function plugin()
idle_text("in " .. info.name .. " waiting for not game") idle_text("in " .. info.name .. " waiting for not game")
until info.name ~= "Game" until info.name ~= "Game"
repeat
events, context, info = coroutine.yield()
idle_text("in " .. info.name .. " waiting for game")
until info.name == "Game"
repeat
events, context, info = coroutine.yield()
idle_text("in " .. info.name .. " waiting for not game")
until info.name ~= "Game"
log("left a game context...") log("left a game context...")
repeat repeat