Don't error out on complex requirements without tooltip.

Since it is not nice to make the game unusable (citation needed) we'll
emit a warning, which is less not nice.
Reported by: @Langbart
Differential revision: https://code.wildfiregames.com/D4930
Reviewed by: @Langbart
Fixes #6724

This was SVN commit r27531.
This commit is contained in:
Freagarach 2023-02-07 07:33:22 +00:00
parent 9a134b88f7
commit fe015fdc1e

View File

@ -968,11 +968,18 @@ function getRequirementsTooltip(enabled, requirements, civ)
return "";
// Simple requirements (one tech) can be translated on the fly.
if ("Techs" in requirements && !requirements.Techs._string.includes(" "))
if ("Techs" in requirements && !requirements.Techs._string.includes(" ") &&
requirements.Techs._string[0] != "!")
return objectionFont(sprintf(translate("Requires %(technology)s"), {
"technology": getEntityNames(GetTechnologyData(requirements.Techs._string, civ))
}));
return objectionFont(translate(requirements.Tooltip));
// More complex ones need a tooltip.
if ("Tooltip" in requirements)
return objectionFont(translate(requirements.Tooltip));
warn("Complex requirements found, but no tooltip specified. More complex requirements can't be translated on the fly easily.")
return "";
}
/**