In gui/gamesetup/Controls/PlayerAssignmentControls.js, class playerAssignmentsControl method onPlayerAssignmentMessage:
- For #5929: Since g_PlayerAssignments was being updated after the onClientJoin and onClientLeave handlers were called and since the handler in gameRegisterStanza was referring to g_PlayerAssignments, it was updating the gamelist with the previous player assignments instead of the new ones.
- For #5933: Since the handlers for onClientJoin may be registered/called in an inconsistent order, it will sometimes send the gameRegisterStanza before the handler in Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js has assigned the new client to an open player slot.
This patch will:
- Pass gameRegisterStanza to playerAssignmentsControl constructor.
- Remove handlers for onClientJoin and onClientLeave from gameRegisterStanza class.
- Call gameRegisterStanza method sendImmediately only once after all handlers have run and after updating g_PlayerAssignments .
- Remove from gameRegisterStanza the dependency on playerAssignmentsControl since the onClientJoin and onClientLeave handlers are removed.