Timestamp:
Jul 10, 2024, 8:20:51 AM (2 weeks ago)
Author:
Dunedan
Message:

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

Location:
ps/trunk/binaries/data/mods/public/gui/gamesetup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/binaries/data/mods/public/gui/gamesetup/Controllers/LobbyGameRegistration.js

    r25851 r28148  
    4747    onClosePage()
    4848    {
    49         if (g_IsController && Engine.HasXmppClient())
    50             Engine.SendUnregisterGame();
     49        Engine.SendUnregisterGame();
    5150    }
    5251
     
    5655    sendDelayed()
    5756    {
    58         if (!g_IsController || !Engine.HasXmppClient())
    59             return;
    60 
    6157        // Already sending an update - do nothing.
    6258        if (this.timer !== undefined)
     
    7167    sendImmediately()
    7268    {
    73         if (!g_IsController || !Engine.HasXmppClient())
    74             return;
    75 
    7669        // Wait until a map has been selected.
    7770        if (!g_GameSettings.map.map)
  • ps/trunk/binaries/data/mods/public/gui/gamesetup/SetupWindow.js

    r25683 r28148  
    3434        let gameSettingsController = new GameSettingsController(this, netMessages, playerAssignmentsController, mapCache);
    3535        let readyController = new ReadyController(netMessages, gameSettingsController, playerAssignmentsController);
    36         let lobbyGameRegistrationController = Engine.HasXmppClient() &&
     36        Engine.HasXmppClient() &&
    3737            new LobbyGameRegistrationController(initData, this, netMessages, mapCache, playerAssignmentsController);
    3838
Note: See TracChangeset for help on using the changeset viewer.