Changeset 27531

Timestamp:
Feb 7, 2023, 8:33:22 AM (18 months ago)
Author:
Freagarach
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/binaries/data/mods/public/gui/common/tooltips.js

    r27505 r27531  
    969969
    970970    // Simple requirements (one tech) can be translated on the fly.
    971     if ("Techs" in requirements && !requirements.Techs._string.includes(" "))
     971    if ("Techs" in requirements && !requirements.Techs._string.includes(" ") &&
     972            requirements.Techs._string[0] != "!")
    972973        return objectionFont(sprintf(translate("Requires %(technology)s"), {
    973974            "technology": getEntityNames(GetTechnologyData(requirements.Techs._string, civ))
    974975        }));
    975     return objectionFont(translate(requirements.Tooltip));
     976
     977    // More complex ones need a tooltip.
     978    if ("Tooltip" in requirements)
     979        return objectionFont(translate(requirements.Tooltip));
     980
     981    warn("Complex requirements found, but no tooltip specified. More complex requirements can't be translated on the fly easily.")
     982    return "";
    976983}
    977984
Note: See TracChangeset for help on using the changeset viewer.