Skirmish AI hosts leaving will break crudeplayerlist upon reloading
Closed this issue · 1 comments
Replication steps:
0. Create a lobby with two players: A (host) and B. Player B hosts a circuit AI or other skirmish AI. Player A hosts a null AI.
- Start the game, plop as usual.
- Have player B leave the game.
- Reload the playerlist
Error:
[t=09:45:30.746776][f=0000736] [cawidgets.lua] Error: Error in Initialize(): [string "LuaUI/Widgets/chili_old/controls/object.lua"]:247: Chili: There is already a control with the name
1
inPlayer List
!
[t=09:45:30.746807][f=0000736] [cawidgets.lua] Error: Removed widget: Chili Crude Player List
Explanation:
Skirmish AIs that leave are no longer considered AI by the player list and the Spring API no longer says they're AI. This gives them a team leader ID of -1 which causes it to fall back on a value given to it by initLeaderID
. This teamrulesparam is created by this line of code.
Solution:
Have the same gadget store if a teamID is AI and fall back to it on L603.
#5367 (adding this as a reference)