Changeset View
Standalone View
binaries/data/mods/public/gui/replaymenu/replay_menu.js
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | for (let replay of g_Replays) | ||||
sanitizeGameAttributes(replay.attribs); | sanitizeGameAttributes(replay.attribs); | ||||
// Extract map names | // Extract map names | ||||
if (g_MapNames.indexOf(replay.attribs.settings.Name) == -1 && replay.attribs.settings.Name != "") | if (g_MapNames.indexOf(replay.attribs.settings.Name) == -1 && replay.attribs.settings.Name != "") | ||||
g_MapNames.push(replay.attribs.settings.Name); | g_MapNames.push(replay.attribs.settings.Name); | ||||
// Extract victory conditions | // Extract victory conditions | ||||
if (replay.attribs.settings.GameType && g_VictoryConditions.indexOf(replay.attribs.settings.GameType) == -1) | for (let vc of replay.attribs.settings.VictoryConditions) | ||||
g_VictoryConditions.push(replay.attribs.settings.GameType); | if (g_VictoryConditions.indexOf(vc) == -1) | ||||
g_VictoryConditions.push(vc); | |||||
elexis: Last time I checked (some releases ago) one could save some performance just loading all… | |||||
Done Inline Actions(I'm really not confident anymore of this being worth the performance effort as opposed to loading it from settings.js. Probably better to replace it with the better than the worse alternative. And displaying gametypes that were never played before could be considered advertizement). elexis: (I'm really not confident anymore of this being worth the performance effort as opposed to… | |||||
Not Done Inline ActionsMaybe the reason it was extracted from maps was to add mod support? elexis: Maybe the reason it was extracted from maps was to add mod support?
Then we would need… | |||||
Not Done Inline Actions(notice this hunk is gone in next diff) bb: (notice this hunk is gone in next diff) | |||||
// Extract playernames | // Extract playernames | ||||
for (let playerData of replay.attribs.settings.PlayerData) | for (let playerData of replay.attribs.settings.PlayerData) | ||||
{ | { | ||||
if (!playerData || playerData.AI) | if (!playerData || playerData.AI) | ||||
continue; | continue; | ||||
// Remove rating from nick | // Remove rating from nick | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | if (!attribs.settings.PlayerData) | ||||
attribs.settings.PlayerData = []; | attribs.settings.PlayerData = []; | ||||
if (!attribs.settings.PopulationCap) | if (!attribs.settings.PopulationCap) | ||||
attribs.settings.PopulationCap = 300; | attribs.settings.PopulationCap = 300; | ||||
if (!attribs.settings.mapType) | if (!attribs.settings.mapType) | ||||
attribs.settings.mapType = "skirmish"; | attribs.settings.mapType = "skirmish"; | ||||
if (!attribs.settings.GameType) | |||||
attribs.settings.GameType = "conquest"; | |||||
Not Done Inline Actions(How, why has this even been here... Don't tell me it was a silent default hardcoded everywhere) elexis: (How, why has this even been here... Don't tell me it was a silent default hardcoded everywhere) | |||||
Not Done Inline ActionsI don't tell you bb: I don't tell you | |||||
Not Done Inline ActionsIt comes from r17054, was probably introduced for completeness. (Could nuke some others too, probably in a separate patch, probably something for after the release or for when being really certain that it doesn't break under any circumstance.) elexis: It comes from r17054, was probably introduced for completeness. (Could nuke some others too… | |||||
// Remove gaia | // Remove gaia | ||||
if (attribs.settings.PlayerData.length && attribs.settings.PlayerData[0] == null) | if (attribs.settings.PlayerData.length && attribs.settings.PlayerData[0] == null) | ||||
attribs.settings.PlayerData.shift(); | attribs.settings.PlayerData.shift(); | ||||
attribs.settings.PlayerData.forEach((pData, index) => { | attribs.settings.PlayerData.forEach((pData, index) => { | ||||
if (!pData.Name) | if (!pData.Name) | ||||
pData.Name = ""; | pData.Name = ""; | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | function displayReplayDetails() | ||||
if (!replaySelected) | if (!replaySelected) | ||||
return; | return; | ||||
let replay = g_ReplaysFiltered[selected]; | let replay = g_ReplaysFiltered[selected]; | ||||
Engine.GetGUIObjectByName("sgMapName").caption = translate(replay.attribs.settings.Name); | Engine.GetGUIObjectByName("sgMapName").caption = translate(replay.attribs.settings.Name); | ||||
Engine.GetGUIObjectByName("sgMapSize").caption = translateMapSize(replay.attribs.settings.Size); | Engine.GetGUIObjectByName("sgMapSize").caption = translateMapSize(replay.attribs.settings.Size); | ||||
Engine.GetGUIObjectByName("sgMapType").caption = translateMapType(replay.attribs.settings.mapType); | Engine.GetGUIObjectByName("sgMapType").caption = translateMapType(replay.attribs.settings.mapType); | ||||
Engine.GetGUIObjectByName("sgVictory").caption = translateVictoryCondition(replay.attribs.settings.GameType); | Engine.GetGUIObjectByName("sgVictory").caption = replay.attribs.settings.VictoryConditions.map(vc => | ||||
translateVictoryCondition(vc)).join(", "); | |||||
Not Done Inline Actionssame elexis: same | |||||
Not Done Inline Actions(Thought we had translation context somewhere, apparently not. So ok.) elexis: (Thought we had translation context somewhere, apparently not. So ok.) | |||||
Engine.GetGUIObjectByName("sgNbPlayers").caption = sprintf(translate("Players: %(numberOfPlayers)s"), | Engine.GetGUIObjectByName("sgNbPlayers").caption = sprintf(translate("Players: %(numberOfPlayers)s"), | ||||
{ "numberOfPlayers": replay.attribs.settings.PlayerData.length }); | { "numberOfPlayers": replay.attribs.settings.PlayerData.length }); | ||||
Engine.GetGUIObjectByName("replayFilename").caption = Engine.GetReplayDirectoryName(replay.directory); | Engine.GetGUIObjectByName("replayFilename").caption = Engine.GetReplayDirectoryName(replay.directory); | ||||
let metadata = Engine.GetReplayMetadata(replay.directory); | let metadata = Engine.GetReplayMetadata(replay.directory); | ||||
Engine.GetGUIObjectByName("sgPlayersNames").caption = | Engine.GetGUIObjectByName("sgPlayersNames").caption = | ||||
formatPlayerInfo( | formatPlayerInfo( | ||||
replay.attribs.settings.PlayerData, | replay.attribs.settings.PlayerData, | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |
Last time I checked (some releases ago) one could save some performance just loading all options rather than extracting them from the maps, but not important to check now.