Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#3602 closed defect (fixed)

[PATCH] Game can't be started after gamesetup rejoin

Reported by: elexis Owned by: elexis
Priority: Must Have Milestone: Alpha 20
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description

Reproduce:

  1. Start hosting a game with 2 player slots
  2. Join with a client and leave the match
  3. Set number of players to 1
  4. Rejoin with the client

When typing chat with the rejoined client

ERROR: JavaScript error: gui/gamesetup/gamesetup.js line 1814
TypeError: g_GameAttributes.settings.PlayerData[(g_PlayerAssignments[msg.guid].player - 1)] is undefined
  addChatMessage@gui/gamesetup/gamesetup.js:1814:3
  handleNetMessage@gui/gamesetup/gamesetup.js:510:61
  onTick@gui/gamesetup/gamesetup.js:875:4
  __eventhandler185 (tick)@setupWindow tick:0:1

When trying to start the game:

ERROR: JavaScript error: gui/gamesetup/gamesetup.js line 1188
TypeError: g_GameAttributes.settings.PlayerData[(player.player - 1)] is undefined
  launchGame@gui/gamesetup/gamesetup.js:1188:4
  __eventhandler124 (press)@startGame press:1:7

This bug exists since alpha 18.

Attachments (1)

patch_3602.patch (665 bytes) - added by Pilzschaf 5 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by Pilzschaf

Owner: set to Pilzschaf
Status: newassigned

comment:2 Changed 5 years ago by Pilzschaf

Can't reproduce this bug any more. Any suggestions? How exactly should I set the number of players to 1? Through adding an AI to the slot? One time I was able to reproduce this but now without a changed codebase it isn't reproducible any more.

comment:3 Changed 5 years ago by Pilzschaf

Keywords: review patch added
Owner: Pilzschaf deleted
Status: assignednew
Summary: Game can't be started after gamesetup rejoin[PATCH] Game can't be started after gamesetup rejoin

Changed 5 years ago by Pilzschaf

Attachment: patch_3602.patch added

comment:4 Changed 4 years ago by leper

Keywords: review removed

Read the Coding Conventions. The patch likely has some conflicts with some recent changes too. Sorry that it took so long to take a look at this.

comment:5 Changed 4 years ago by elexis

Owner: set to elexis
Resolution: fixed
Status: newclosed

In 17444:

Fix a playerassignment-bug in the gamesetup where the game couldn't be started if a player has rejoined the gamesetup while the host reduced the number of players.
The previous code failed at it as it looped over g_PlayerAssignments instead of all slots.

Based on patch by Pilzschaf, fixes #3602.

comment:6 Changed 4 years ago by elexis

Milestone: BacklogAlpha 20

The patch violated almost every rule of the coding conventions and you forgot to define i. Yet it fixes the actual issue, so thanks for investigating and uploading it! :-)

Note: See TracTickets for help on using tickets.