Opened 8 years ago

Closed 8 years ago

Last modified 8 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 8 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Pilzschaf, 8 years ago

Owner: set to Pilzschaf
Status: newassigned

comment:2 by Pilzschaf, 8 years ago

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 by Pilzschaf, 8 years ago

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

by Pilzschaf, 8 years ago

Attachment: patch_3602.patch added

comment:4 by leper, 8 years ago

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 by elexis, 8 years ago

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 by elexis, 8 years ago

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.