1
1
forked from 0ad/0ad

Fix lobby dgame details panel with incompatible mods.

There was an issue in 07e44a75a1 that made the game details mostly red
with incompatible mods.
This fixes that: now only the 'Mods' title is red, and I added specific
text to highlight why it's colored that way.

Based on a patch by: Langbart
Differential Revision: https://code.wildfiregames.com/D4153
This was SVN commit r25778.
This commit is contained in:
wraitii 2021-06-12 08:57:34 +00:00
parent 721cfa7ae6
commit 42d6893eb8

View File

@ -103,13 +103,15 @@ class GameDetails
txt += "\n" + formatPlayerInfo(game.players);
// Mod information
txt += "\n\n" + setStringTags(this.ModsFormat, this.CaptionTags);
txt += "\n\n";
if (!game.isCompatible)
txt = setStringTags(coloredText(txt, "red"), {
txt += setStringTags(coloredText(setStringTags(this.IncompatibleModsFormat, this.CaptionTags), "red"), {
"tooltip": sprintf(translate("You have some incompatible mods:\n%(details)s"), {
"details": comparedModsString(game.mods, Engine.GetEngineInfo().mods),
}),
});
else
txt += setStringTags(this.ModsFormat, this.CaptionTags);
const sortedMods = game.mods;
sortedMods.sort((a, b) => a.ignoreInCompatibilityChecks - b.ignoreInCompatibilityChecks);
@ -148,6 +150,8 @@ GameDetails.prototype.Comma = translate(", ");
GameDetails.prototype.ModsFormat = translate("Mods:");
GameDetails.prototype.IncompatibleModsFormat = translate("Mods (incompatible):");
// Translation: %(time)s is the hour and minute here.
GameDetails.prototype.GameStartFormat = translate("Game started at %(time)s");