Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/functions_utility_loadsave.js
function sortDecreasingDate(a, b) | function sortDecreasingDate(a, b) | ||||
{ | { | ||||
return b.metadata.time - a.metadata.time; | return b.metadata.time - a.metadata.time; | ||||
} | } | ||||
function generateLabel(metadata, engineInfo) | function isCompatibleSavegame(metadata, engineInfo) | ||||
{ | { | ||||
let dateTimeString = Engine.FormatMillisecondsIntoDateStringLocal(metadata.time*1000, translate("yyyy-MM-dd HH:mm:ss")); | return engineInfo && hasSameSavegameVersion(metadata, engineInfo) && | ||||
let dateString = sprintf(translate("\\[%(date)s]"), { "date": dateTimeString }); | hasSameEngineVersion(metadata, engineInfo) & hasSameMods(metadata, engineInfo); | ||||
} | |||||
if (engineInfo) | function generateSavegameDateString(metadata, engineInfo) | ||||
elexis: red & orange seem pointless on first sight. either its compatible or its not.
instead of… | |||||
Done Inline Actionssince we touch all lines having that name and because its in common/, should be renamed elexis: since we touch all lines having that name and because its in common/, should be renamed… | |||||
{ | { | ||||
if (!hasSameSavegameVersion(metadata, engineInfo) || !hasSameEngineVersion(metadata, engineInfo)) | let dateString = Engine.FormatMillisecondsIntoDateStringLocal(metadata.time * 1000, translate("yyyy-MM-dd HH:mm:ss")); | ||||
Done Inline Actionsspaces elexis: spaces | |||||
dateString = "[color=\"red\"]" + dateString + "[/color]"; | if (!isCompatibleSavegame(metadata, engineInfo)) | ||||
Done Inline Actionsso remove the copy from replay_menu elexis: so remove the copy from replay_menu | |||||
else if (!hasSameMods(metadata, engineInfo)) | dateString = compatibilityColor(dateString); | ||||
elexisUnsubmitted Not Done Inline ActionsShould _always_ pass a second argument. Should be true or false, not undefined. This is better as it also avoid the variable and if-statement. return compatibilityColor( Engine.FormatMillisecondsIntoDateStringLocal(metadata.time * 1000, translate("yyyy-MM-dd HH:mm:ss")), isCompatibleSavegame(metadata, engineInfo)); elexis: Should _always_ pass a second argument. Should be true or false, not undefined.
This is better… | |||||
dateString = "[color=\"orange\"]" + dateString + "[/color]"; | return dateString; | ||||
} | } | ||||
function generateSavegameLabel(metadata, engineInfo) | |||||
Done Inline Actionssame as above, generateSavegameLabel? elexis: same as above, generateSavegameLabel? | |||||
{ | |||||
return sprintf( | return sprintf( | ||||
metadata.description ? | metadata.description ? | ||||
translate("%(dateString)s %(map)s - %(description)s") : | translate("%(dateString)s %(map)s - %(description)s") : | ||||
translate("%(dateString)s %(map)s"), | translate("%(dateString)s %(map)s"), | ||||
{ | { | ||||
"dateString": dateString, | "dateString": generateSavegameDateString(metadata, engineInfo), | ||||
"map": metadata.initAttributes.map, | "map": metadata.initAttributes.map, | ||||
"description": metadata.description || "" | "description": metadata.description || "" | ||||
} | } | ||||
); | ); | ||||
} | } | ||||
/** | /** | ||||
* Check the version compatibility between the saved game to be loaded and the engine | * Check the version compatibility between the saved game to be loaded and the engine | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
red & orange seem pointless on first sight. either its compatible or its not.
instead of showing an unexplained color, we should display the incompatibility reason in the selection details at some point.
IMO it's weird to have the first cell red&orange and the other grey, should be all the same color IMO