Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/replaymenu/replay_menu.js
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
function init(data) | function init(data) | ||||
{ | { | ||||
if (!g_Settings) | if (!g_Settings) | ||||
{ | { | ||||
Engine.SwitchGuiPage("page_pregame.xml"); | Engine.SwitchGuiPage("page_pregame.xml"); | ||||
return; | return; | ||||
} | } | ||||
loadReplays(data && data.replaySelectionData); | loadReplays(data && data.replaySelectionData, false); | ||||
if (!g_Replays) | if (!g_Replays) | ||||
{ | { | ||||
Engine.SwitchGuiPage("page_pregame.xml"); | Engine.SwitchGuiPage("page_pregame.xml"); | ||||
return; | return; | ||||
} | } | ||||
initHotkeyTooltips(); | initHotkeyTooltips(); | ||||
displayReplayList(); | displayReplayList(); | ||||
} | } | ||||
/** | /** | ||||
* Store the list of replays loaded in C++ in g_Replays. | * Store the list of replays loaded in C++ in g_Replays. | ||||
* Check timestamp and compatibility and extract g_Playernames, g_MapNames, g_VictoryConditions. | * Check timestamp and compatibility and extract g_Playernames, g_MapNames, g_VictoryConditions. | ||||
* Restore selected filters and item. | * Restore selected filters and item. | ||||
elexis: Should have a comment for the `loadReplays` proposed in some other inline comment.
`@param`… | |||||
Not Done Inline Actions@param {boolean} reload - if the cache should be relaoded. Why not name it compareFiles too? I had written this one since the above description is a bit arbitrary "data contains data" * @param {object} replaySelectionData - Currently selected filters and item to be restored after the loading. * @param {bool} compareFiles - If true, compares files briefly (which might be slow with optical harddrives), * otherwise blindly trusts the replay cache. elexis: `@param {boolean} reload - if the cache should be relaoded.`
Why not name it `compareFiles`… | |||||
*/ | */ | ||||
function loadReplays(replaySelectionData) | function loadReplays(replaySelectionData, reload) | ||||
{ | { | ||||
g_Replays = Engine.GetReplays(); | g_Replays = Engine.GetReplays(reload); | ||||
if (!g_Replays) | if (!g_Replays) | ||||
return; | return; | ||||
g_Playernames = []; | g_Playernames = []; | ||||
for (let replay of g_Replays) | for (let replay of g_Replays) | ||||
{ | { | ||||
let nonAIPlayers = 0; | let nonAIPlayers = 0; | ||||
▲ Show 20 Lines • Show All 271 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Should have a comment for the loadReplays proposed in some other inline comment.
@param while adding weird new stuff