From 82d93c89dd6fef2cdf454c674d5778a00af93b29 Mon Sep 17 00:00:00 2001 From: elexis Date: Fri, 4 Dec 2015 13:10:50 +0000 Subject: [PATCH] Gamesetup cleanup. Refs #3680 Remove a broken implementation of default maps. Remove some unneeded comments. This was SVN commit r17376. --- .../public/gui/common/functions_utility.js | 23 ------------------- .../mods/public/gui/gamesetup/gamesetup.js | 12 ---------- .../public/gui/session/utility_functions.js | 7 ------ 3 files changed, 42 deletions(-) diff --git a/binaries/data/mods/public/gui/common/functions_utility.js b/binaries/data/mods/public/gui/common/functions_utility.js index 7ce0d88296..d77c68c0fe 100644 --- a/binaries/data/mods/public/gui/common/functions_utility.js +++ b/binaries/data/mods/public/gui/common/functions_utility.js @@ -1,10 +1,3 @@ -/* - DESCRIPTION : Generic utility functions. - NOTES : -*/ - -// ==================================================================== - function getRandom(randomMin, randomMax) { // Returns a random whole number in a min..max range. @@ -15,8 +8,6 @@ function getRandom(randomMin, randomMax) return Math.round(randomNum); } -// ==================================================================== - // Get list of XML files in pathname with recursion, excepting those starting with _ function getXMLFileList(pathname) { @@ -40,8 +31,6 @@ function getXMLFileList(pathname) return result; } -// ==================================================================== - // Get list of JSON files in pathname function getJSONFileList(pathname) { @@ -53,8 +42,6 @@ function getJSONFileList(pathname) return files; } -// ==================================================================== - // A sorting function for arrays of objects with 'name' properties, ignoring case function sortNameIgnoreCase(x, y) { @@ -69,8 +56,6 @@ function sortNameIgnoreCase(x, y) return 0; } -// ==================================================================== - /** * Escape tag start and escape characters, so users cannot use special formatting. * Also limit string length to 256 characters (not counting escape characters). @@ -102,8 +87,6 @@ function getMapDescriptionAndPreview(mapType, mapName) }; } -// ==================================================================== - // Convert integer color values to string (for use in GUI objects) function rgbToGuiColor(color, alpha) { @@ -131,8 +114,6 @@ function colorDistance(color1, color2) return Math.sqrt(Math.pow(color2.r - color1.r, 2) + Math.pow(color2.g - color1.g, 2) + Math.pow(color2.b - color1.b, 2)); } -// ==================================================================== - /** * Convert time in milliseconds to [hh:]mm:ss string representation. * @param time Time period in milliseconds (integer) @@ -147,8 +128,6 @@ function timeToString(time) return Engine.FormatMillisecondsIntoDateString(time, format); } -// ==================================================================== - function removeDupes(array) { // loop backwards to make splice operations cheaper @@ -160,7 +139,6 @@ function removeDupes(array) } } -// ==================================================================== // "Inside-out" implementation of Fisher-Yates shuffle function shuffleArray(source) { @@ -177,7 +155,6 @@ function shuffleArray(source) return result; } -// ==================================================================== // Filter out conflicting characters and limit the length of a given name. // @param name Name to be filtered. // @param stripUnicode Whether or not to remove unicode characters. diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup.js b/binaries/data/mods/public/gui/gamesetup/gamesetup.js index c5dfd49def..0efc17984f 100644 --- a/binaries/data/mods/public/gui/gamesetup/gamesetup.js +++ b/binaries/data/mods/public/gui/gamesetup/gamesetup.js @@ -1,12 +1,6 @@ -//////////////////////////////////////////////////////////////////////////////////////////////// -// Constants const g_MatchSettings_SP = "config/matchsettings.json"; const g_MatchSettings_MP = "config/matchsettings.mp.json"; -// TODO: these constants actually don't have an effect and that is not a scenario map, remove them -const DEFAULT_NETWORKED_MAP = "Acropolis 01"; -const DEFAULT_OFFLINE_MAP = "Acropolis 01"; - const g_Ceasefire = prepareForDropdown(g_Settings ? g_Settings.Ceasefire : undefined); const g_GameSpeeds = prepareForDropdown(g_Settings ? g_Settings.GameSpeeds.filter(speed => !speed.ReplayOnly) : undefined); const g_MapSizes = prepareForDropdown(g_Settings ? g_Settings.MapSizes : undefined); @@ -18,8 +12,6 @@ const g_VictoryConditions = prepareForDropdown(g_Settings ? g_Settings.VictoryCo // All colors except gaia const g_PlayerColors = g_Settings ? g_Settings.PlayerDefaults.slice(1).map(pData => pData.Color) : undefined; -//////////////////////////////////////////////////////////////////////////////////////////////// - // Is this is a networked game, or offline var g_IsNetworked; @@ -70,8 +62,6 @@ var g_AssignedCount = 0; // tick handler var g_LoadingState = 0; // 0 = not started, 1 = loading, 2 = loaded -//////////////////////////////////////////////////////////////////////////////////////////////// - function init(attribs) { if (!g_Settings) @@ -977,9 +967,7 @@ function selectMapType(type) switch (g_GameAttributes.mapType) { case "scenario": - // Set a default map g_GameAttributes.mapPath = "maps/scenarios/"; - g_GameAttributes.map = g_GameAttributes.mapPath + (g_IsNetworked ? DEFAULT_NETWORKED_MAP : DEFAULT_OFFLINE_MAP); g_GameAttributes.settings.AISeed = Math.floor(Math.random() * 65536); break; diff --git a/binaries/data/mods/public/gui/session/utility_functions.js b/binaries/data/mods/public/gui/session/utility_functions.js index 04025224cb..c07eafa1ef 100644 --- a/binaries/data/mods/public/gui/session/utility_functions.js +++ b/binaries/data/mods/public/gui/session/utility_functions.js @@ -1,10 +1,3 @@ -//-------------------------------- -------------------------------- -// Utility functions -//-------------------------------- -------------------------------- - -//=============================================== -// Player functions - // Get the basic player data function getPlayerData(playerAssignments) {