forked from 0ad/0ad
Instantiate controller only for the host
This moves the check whether a player is the host out of `LobbyGameRegistrationController` and only creates an instance of it in `SetupWindow` if the player is the host. This solves a problem with `LobbyGameRegistrationController.onGameStart()` getting triggered by players not being the host and sending unnecessary and invalid changestate stanzas to XpartaMuPP. Patch by: @Dunedan Accepted by: @Stan Differential Revision: https://code.wildfiregames.com/D5270 This was SVN commit r28148.
This commit is contained in:
parent
62692ca270
commit
b68a22ecdb
@ -46,7 +46,6 @@ class LobbyGameRegistrationController
|
||||
|
||||
onClosePage()
|
||||
{
|
||||
if (g_IsController && Engine.HasXmppClient())
|
||||
Engine.SendUnregisterGame();
|
||||
}
|
||||
|
||||
@ -55,9 +54,6 @@ class LobbyGameRegistrationController
|
||||
*/
|
||||
sendDelayed()
|
||||
{
|
||||
if (!g_IsController || !Engine.HasXmppClient())
|
||||
return;
|
||||
|
||||
// Already sending an update - do nothing.
|
||||
if (this.timer !== undefined)
|
||||
return;
|
||||
@ -70,9 +66,6 @@ class LobbyGameRegistrationController
|
||||
*/
|
||||
sendImmediately()
|
||||
{
|
||||
if (!g_IsController || !Engine.HasXmppClient())
|
||||
return;
|
||||
|
||||
// Wait until a map has been selected.
|
||||
if (!g_GameSettings.map.map)
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ class SetupWindow
|
||||
let playerAssignmentsController = new PlayerAssignmentsController(this, netMessages);
|
||||
let gameSettingsController = new GameSettingsController(this, netMessages, playerAssignmentsController, mapCache);
|
||||
let readyController = new ReadyController(netMessages, gameSettingsController, playerAssignmentsController);
|
||||
let lobbyGameRegistrationController = Engine.HasXmppClient() &&
|
||||
const lobbyGameRegistrationController = g_IsController && Engine.HasXmppClient() &&
|
||||
new LobbyGameRegistrationController(initData, this, netMessages, mapCache, playerAssignmentsController);
|
||||
|
||||
// These class instances control central data and do not manage any GUI Object.
|
||||
|
Loading…
Reference in New Issue
Block a user