1
0
forked from 0ad/0ad

Fix aiconfig dialog errors in multiplayer mode following b120404141, refs #3911 when reducing playercount and following 86c151ebaa/D1684 when unassigning the AI, reported by smiley and Freagarach.

Differential Revision: https://code.wildfiregames.com/D2538
This was SVN commit r23341.
This commit is contained in:
elexis 2020-01-07 13:30:09 +00:00
parent 385377820b
commit 626822e2ce

View File

@ -2437,8 +2437,9 @@ function updateGUIObjects()
// Refresh AI config page
if (g_LastViewedAIPlayer != -1)
{
let playerIndex = g_LastViewedAIPlayer;
Engine.PopGuiPage();
openAIConfig(g_LastViewedAIPlayer);
openAIConfig(playerIndex);
}
}
@ -2463,6 +2464,9 @@ function updateGameAttributes()
function openAIConfig(playerSlot)
{
if (!g_GameAttributes.settings.PlayerData[playerSlot])
return;
g_LastViewedAIPlayer = playerSlot;
Engine.PushGuiPage(
@ -2476,7 +2480,7 @@ function openAIConfig(playerSlot)
ai => {
g_LastViewedAIPlayer = -1;
if (!ai.save || !g_IsController)
if (!ai || !ai.save || !g_IsController)
return;
g_GameAttributes.settings.PlayerData[ai.playerSlot].AI = ai.id;