This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 21843 for ps


Ignore:
Timestamp:
06/07/18 00:25:15 (7 years ago)
Author:
elexis
Message:

Prevent calling the JS gamestart function twice when doubleclicking on the "Start Game" button.

It triggered an OOS on rejoin prior to rP21836, refs #5199 and
resulted in the playernames of the current match persisting into new gamesetups, fixes #5206.

Differential Revision: https://code.wildfiregames.com/D1558
Comments By: wraitii

File:
1 edited

Legend:

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

    r21802 r21843  
    278278
    279279/**
    280  * Used to prevent calling resetReadyData when starting a game.
     280 * Used to prevent calling resetReadyData when starting a game or doubleclicking on the "Start Game" button.
    281281 */
    282282var g_GameStarted = false;
     
    10191019                    translate("Start a new game with the current settings.") :
    10201020                    translate("Start a new game with the current settings (disabled until all players are ready)"),
    1021         "enabled": () => !g_IsController ||
    1022                          Object.keys(g_PlayerAssignments).every(guid => g_PlayerAssignments[guid].status ||
    1023                                                                         g_PlayerAssignments[guid].player == -1 ||
    1024                                                                         guid == Engine.GetPlayerGUID() && g_IsController),
     1021        "enabled": () => !g_GameStarted && (
     1022                           !g_IsController ||
     1023                           Object.keys(g_PlayerAssignments).every(guid => g_PlayerAssignments[guid].status ||
     1024                                                                          g_PlayerAssignments[guid].player == -1 ||
     1025                                                                          guid == Engine.GetPlayerGUID() && g_IsController)),
    10251026        "hidden": () =>
    10261027            !g_PlayerAssignments[Engine.GetPlayerGUID()] ||
     
    21802181    }
    21812182
    2182     if (!g_GameAttributes.map)
     2183    if (!g_GameAttributes.map || g_GameStarted)
    21832184        return;
     2185
     2186    // Prevent reseting the readystate or calling this function twice
     2187    g_GameStarted = true;
     2188    updateGUIMiscControl("startGame");
    21842189
    21852190    savePersistMatchSettings();
     
    22012206
    22022207    g_GameAttributes.settings.TriggerScripts = g_GameAttributes.settings.VictoryScripts.concat(g_GameAttributes.settings.TriggerScripts || []);
    2203 
    2204     // Prevent reseting the readystate
    2205     g_GameStarted = true;
    22062208
    22072209    g_GameAttributes.settings.mapType = g_GameAttributes.mapType;
Note: See TracChangeset for help on using the changeset viewer.