Deprecation message options only (#5352)

* Do not show RulesetErrorSeverity.WarningOptionsOnly on new game screen

* Do not show RulesetErrorSeverity.WarningOptionsOnly on new game screen - fresh atlas
This commit is contained in:
SomeTroglodyte 2021-09-29 20:25:44 +02:00 committed by GitHub
parent fb30a76e85
commit 6cfc0a82d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 768 additions and 715 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1010 KiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -266,6 +266,13 @@ class Ruleset {
fun hasReligion() = beliefs.any() && modWithReligionLoaded
/** Used for displaying a RuleSet's name */
override fun toString() = when {
name.isNotEmpty() -> name
mods.isEmpty() -> BaseRuleset.Civ_V_Vanilla.fullName //todo differentiate once more than 1 BaseRuleset
else -> "Combined RuleSet"
}
fun getSummary(): String {
val stringList = ArrayList<String>()
if (modOptions.isBaseRuleset) stringList += "Base Ruleset"
@ -320,10 +327,10 @@ class Ruleset {
class RulesetError(val text:String, val errorSeverityToReport: RulesetErrorSeverity)
enum class RulesetErrorSeverity{
enum class RulesetErrorSeverity {
OK,
Warning,
WarningOptionsOnly,
Warning,
Error,
}
@ -336,13 +343,17 @@ class Ruleset {
add(RulesetError(text, errorSeverityToReport))
}
fun getFinalSeverity(): RulesetErrorSeverity {
private fun getFinalSeverity(): RulesetErrorSeverity {
if (isEmpty()) return RulesetErrorSeverity.OK
return this.maxOf { it.errorSeverityToReport }
}
/** @return `true` means severe errors make the mod unplayable */
fun isError() = getFinalSeverity() == RulesetErrorSeverity.Error
/** @return `true` means problems exist, Options screen mod checker or unit tests for vanilla ruleset should complain */
fun isNotOK() = getFinalSeverity() != RulesetErrorSeverity.OK
/** @return `true` means at least errors impacting gameplay exist, new game screen should warn or block */
fun isWarnUser() = getFinalSeverity() >= RulesetErrorSeverity.Warning
fun getErrorText() =
filter { it.errorSeverityToReport != RulesetErrorSeverity.WarningOptionsOnly }

View File

@ -80,7 +80,7 @@ class ModCheckboxTable(
// Check over complete combination of selected mods
val complexModLinkCheck = RulesetCache.checkCombinedModLinks(mods)
if (complexModLinkCheck.isNotOK()) {
if (complexModLinkCheck.isWarnUser()) {
lastToast?.close()
val toastMessage = (
if (complexModLinkCheck.isError()) "The mod combination you selected is incorrectly defined!"

View File

@ -34,7 +34,7 @@ import com.badlogic.gdx.utils.Array as GdxArray
/**
* The Options (Settings) Popup
* @param previousScreen Tha caller - note if this is a [WorldScreen] or [MainMenuScreen] they will be rebuilt when major options change.
* @param previousScreen The caller - note if this is a [WorldScreen] or [MainMenuScreen] they will be rebuilt when major options change.
*/
//region Fields
class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousScreen) {
@ -275,13 +275,13 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
val lines = ArrayList<FormattedLine>()
var noProblem = true
for (mod in RulesetCache.values.sortedBy { it.name }) {
val label = if (mod.name.isEmpty()) BaseRuleset.Civ_V_Vanilla.fullName else mod.name
lines += FormattedLine("$label{}", starred = true, header = 3)
// Appending {} is a dirty trick to deactivate the automatic translation which would drop [] from unique messages
lines += FormattedLine("$mod{}", starred = true, header = 3)
val modLinks =
if (complex) RulesetCache.checkCombinedModLinks(linkedSetOf(mod.name))
else mod.checkModLinks()
for (error in modLinks) {
for (error in modLinks.sortedByDescending { it.errorSeverityToReport }) {
val color = when (error.errorSeverityToReport) {
Ruleset.RulesetErrorSeverity.OK -> "#0F0"
Ruleset.RulesetErrorSeverity.Warning,