diff --git a/binaries/data/mods/public/gamesettings/GameSettings.js b/binaries/data/mods/public/gamesettings/GameSettings.js index 0dbe5912f6..e6625ac79c 100644 --- a/binaries/data/mods/public/gamesettings/GameSettings.js +++ b/binaries/data/mods/public/gamesettings/GameSettings.js @@ -20,7 +20,7 @@ class GameSettings }); Object.defineProperty(this, "savegameID", { - "value": !!savegameID, + "value": savegameID, }); // Load all possible civ data - don't presume that some will be available. diff --git a/binaries/data/mods/public/gui/gamesetup/SetupWindow.js b/binaries/data/mods/public/gui/gamesetup/SetupWindow.js index dda689b971..4dc88cb5ec 100644 --- a/binaries/data/mods/public/gui/gamesetup/SetupWindow.js +++ b/binaries/data/mods/public/gui/gamesetup/SetupWindow.js @@ -30,7 +30,7 @@ class SetupWindow const mapCache = new MapCache(); g_GameSettings = new GameSettings(); - g_GameSettings.init(mapCache, g_IsController ? savedGame : null); + g_GameSettings.init(mapCache, g_IsController ? savedGame : undefined); let netMessages = new NetMessages(); diff --git a/binaries/data/mods/public/gui/gamesetup_mp/gamesetup_mp.js b/binaries/data/mods/public/gui/gamesetup_mp/gamesetup_mp.js index 667d86be95..2ae6a5eebf 100644 --- a/binaries/data/mods/public/gui/gamesetup_mp/gamesetup_mp.js +++ b/binaries/data/mods/public/gui/gamesetup_mp/gamesetup_mp.js @@ -319,7 +319,7 @@ async function handleAuthenticated(message, loadSavedGame) } g_IsConnecting = false; - const savegameID = loadSavedGame ? await Engine.PushGuiPage("page_loadgame.xml") : null; + const savegameID = loadSavedGame ? await Engine.PushGuiPage("page_loadgame.xml") : undefined; if (loadSavedGame && !savegameID) { @@ -329,7 +329,7 @@ async function handleAuthenticated(message, loadSavedGame) } Engine.SwitchGuiPage("page_gamesetup.xml", { - "savedGame": savegameID ?? message.savedGame, + "savedGame": savegameID, // Undefined or the savegame ID "serverName": g_ServerName, "hasPassword": g_ServerHasPassword }); diff --git a/source/network/scripting/JSInterface_Network.cpp b/source/network/scripting/JSInterface_Network.cpp index f0acf1730a..ba5162521d 100644 --- a/source/network/scripting/JSInterface_Network.cpp +++ b/source/network/scripting/JSInterface_Network.cpp @@ -283,7 +283,7 @@ void StartNetworkGame(const ScriptInterface& scriptInterface, JS::HandleValue sa JS::RootedValue attribs(rq.cx, attribs1); std::string attributesAsString{Script::StringifyJSON(rq, &attribs)}; - if (savegame.isFalse()) + if (savegame.isUndefined()) { g_NetClient->SendStartGameMessage(attributesAsString); return;