mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 17:28:57 +07:00
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:
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 |
@ -266,6 +266,13 @@ class Ruleset {
|
|||||||
|
|
||||||
fun hasReligion() = beliefs.any() && modWithReligionLoaded
|
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 {
|
fun getSummary(): String {
|
||||||
val stringList = ArrayList<String>()
|
val stringList = ArrayList<String>()
|
||||||
if (modOptions.isBaseRuleset) stringList += "Base Ruleset"
|
if (modOptions.isBaseRuleset) stringList += "Base Ruleset"
|
||||||
@ -322,8 +329,8 @@ class Ruleset {
|
|||||||
class RulesetError(val text:String, val errorSeverityToReport: RulesetErrorSeverity)
|
class RulesetError(val text:String, val errorSeverityToReport: RulesetErrorSeverity)
|
||||||
enum class RulesetErrorSeverity {
|
enum class RulesetErrorSeverity {
|
||||||
OK,
|
OK,
|
||||||
Warning,
|
|
||||||
WarningOptionsOnly,
|
WarningOptionsOnly,
|
||||||
|
Warning,
|
||||||
Error,
|
Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,13 +343,17 @@ class Ruleset {
|
|||||||
add(RulesetError(text, errorSeverityToReport))
|
add(RulesetError(text, errorSeverityToReport))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getFinalSeverity(): RulesetErrorSeverity {
|
private fun getFinalSeverity(): RulesetErrorSeverity {
|
||||||
if (isEmpty()) return RulesetErrorSeverity.OK
|
if (isEmpty()) return RulesetErrorSeverity.OK
|
||||||
return this.maxOf { it.errorSeverityToReport }
|
return this.maxOf { it.errorSeverityToReport }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return `true` means severe errors make the mod unplayable */
|
||||||
fun isError() = getFinalSeverity() == RulesetErrorSeverity.Error
|
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
|
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() =
|
fun getErrorText() =
|
||||||
filter { it.errorSeverityToReport != RulesetErrorSeverity.WarningOptionsOnly }
|
filter { it.errorSeverityToReport != RulesetErrorSeverity.WarningOptionsOnly }
|
||||||
|
@ -80,7 +80,7 @@ class ModCheckboxTable(
|
|||||||
|
|
||||||
// Check over complete combination of selected mods
|
// Check over complete combination of selected mods
|
||||||
val complexModLinkCheck = RulesetCache.checkCombinedModLinks(mods)
|
val complexModLinkCheck = RulesetCache.checkCombinedModLinks(mods)
|
||||||
if (complexModLinkCheck.isNotOK()) {
|
if (complexModLinkCheck.isWarnUser()) {
|
||||||
lastToast?.close()
|
lastToast?.close()
|
||||||
val toastMessage = (
|
val toastMessage = (
|
||||||
if (complexModLinkCheck.isError()) "The mod combination you selected is incorrectly defined!"
|
if (complexModLinkCheck.isError()) "The mod combination you selected is incorrectly defined!"
|
||||||
|
@ -34,7 +34,7 @@ import com.badlogic.gdx.utils.Array as GdxArray
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The Options (Settings) Popup
|
* 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
|
//region Fields
|
||||||
class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousScreen) {
|
class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousScreen) {
|
||||||
@ -275,13 +275,13 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
|||||||
val lines = ArrayList<FormattedLine>()
|
val lines = ArrayList<FormattedLine>()
|
||||||
var noProblem = true
|
var noProblem = true
|
||||||
for (mod in RulesetCache.values.sortedBy { it.name }) {
|
for (mod in RulesetCache.values.sortedBy { it.name }) {
|
||||||
val label = if (mod.name.isEmpty()) BaseRuleset.Civ_V_Vanilla.fullName else mod.name
|
// Appending {} is a dirty trick to deactivate the automatic translation which would drop [] from unique messages
|
||||||
lines += FormattedLine("$label{}", starred = true, header = 3)
|
lines += FormattedLine("$mod{}", starred = true, header = 3)
|
||||||
|
|
||||||
val modLinks =
|
val modLinks =
|
||||||
if (complex) RulesetCache.checkCombinedModLinks(linkedSetOf(mod.name))
|
if (complex) RulesetCache.checkCombinedModLinks(linkedSetOf(mod.name))
|
||||||
else mod.checkModLinks()
|
else mod.checkModLinks()
|
||||||
for (error in modLinks) {
|
for (error in modLinks.sortedByDescending { it.errorSeverityToReport }) {
|
||||||
val color = when (error.errorSeverityToReport) {
|
val color = when (error.errorSeverityToReport) {
|
||||||
Ruleset.RulesetErrorSeverity.OK -> "#0F0"
|
Ruleset.RulesetErrorSeverity.OK -> "#0F0"
|
||||||
Ruleset.RulesetErrorSeverity.Warning,
|
Ruleset.RulesetErrorSeverity.Warning,
|
||||||
|
Reference in New Issue
Block a user