1
0
forked from mirrors/0ad

Reset 'removed' flag before autoassigning players

Fixes #8396
This commit is contained in:
Vantha
2025-10-09 17:15:36 +02:00
committed by Nicolas Auvray
parent 3ffb5ec5a0
commit 48d8238354
@@ -88,11 +88,17 @@ PlayerSettingControls.PlayerAssignment = class PlayerAssignment extends GameSett
if (this.assignedGUID === newGUID) if (this.assignedGUID === newGUID)
return; return;
this.assignedGUID = newGUID; this.assignedGUID = newGUID;
// Remove the AI from the slot if there was one. if (this.assignedGUID)
if (this.assignedGUID && g_GameSettings.playerAI.get(this.playerIndex))
{ {
g_GameSettings.playerAI.setAI(this.playerIndex, undefined); const wasAI = g_GameSettings.playerAI.get(this.playerIndex);
this.gameSettingsController.setNetworkInitAttributes(); const wasRemoved = g_GameSettings.playerRemoved.get(this.playerIndex);
if (wasAI)
g_GameSettings.playerAI.setAI(this.playerIndex, undefined);
else if (wasRemoved)
g_GameSettings.playerRemoved.set(this.playerIndex, false);
if (wasAI || wasRemoved)
this.gameSettingsController.setNetworkInitAttributes();
} }
this.render(); this.render();
} }