ZeroK-RTS / Zero-K

Open source RTS game running on the Spring/Recoil engine
https://zero-k.info
GNU General Public License v2.0
685 stars 205 forks source link

Skirmish AI hosts leaving will break crudeplayerlist upon reloading #5366

Open Arch-Shaman opened 1 week ago

Arch-Shaman commented 1 week ago

Replication steps:

  1. 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.
  2. Start the game, plop as usual.
  3. Have player B leave the game.
  4. 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 in Player 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.

Arch-Shaman commented 1 week ago

5367 (adding this as a reference)