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:
parent
385377820b
commit
626822e2ce
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user