Throw exceptions for better debugging of saved games with missing mods (#2388)
* Throw exceptions for better debugging of saved games with missing mods * Close buttons are added
This commit is contained in:
parent
6fa22a92a1
commit
65b7927df6
4 changed files with 8 additions and 3 deletions
|
@ -210,7 +210,8 @@ class CityConstructions {
|
||||||
|
|
||||||
//region state changing functions
|
//region state changing functions
|
||||||
fun setTransients(){
|
fun setTransients(){
|
||||||
builtBuildingObjects = ArrayList(builtBuildings.map { cityInfo.getRuleset().buildings[it]!! })
|
builtBuildingObjects = ArrayList(builtBuildings.map { cityInfo.getRuleset().buildings[it]
|
||||||
|
?: throw java.lang.Exception("Building $it is not found!")})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addProductionPoints(productionToAdd: Int) {
|
fun addProductionPoints(productionToAdd: Int) {
|
||||||
|
|
|
@ -338,7 +338,8 @@ class CivilizationInfo {
|
||||||
* And if they civs on't yet know who they are then they don;t know if they're barbarians =\
|
* And if they civs on't yet know who they are then they don;t know if they're barbarians =\
|
||||||
* */
|
* */
|
||||||
fun setNationTransient(){
|
fun setNationTransient(){
|
||||||
nation = gameInfo.ruleSet.nations[civName]!!
|
nation = gameInfo.ruleSet.nations[civName]
|
||||||
|
?: throw java.lang.Exception("Nation $civName is not found!")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setTransients() {
|
fun setTransients() {
|
||||||
|
|
|
@ -307,7 +307,8 @@ class MapUnit {
|
||||||
fun setTransients(ruleset: Ruleset) {
|
fun setTransients(ruleset: Ruleset) {
|
||||||
promotions.unit=this
|
promotions.unit=this
|
||||||
mapUnitAction?.unit = this
|
mapUnitAction?.unit = this
|
||||||
baseUnit=ruleset.units[name]!!
|
baseUnit=ruleset.units[name]
|
||||||
|
?: throw java.lang.Exception("Unit $name is not found!")
|
||||||
updateUniques()
|
updateUniques()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,13 @@ class LoadGameScreen : PickerScreen() {
|
||||||
if (ex is UncivShowableException && ex.localizedMessage != null) {
|
if (ex is UncivShowableException && ex.localizedMessage != null) {
|
||||||
// thrown exceptions are our own tests and can be shown to the user
|
// thrown exceptions are our own tests and can be shown to the user
|
||||||
cantLoadGamePopup.addGoodSizedLabel(ex.localizedMessage).row()
|
cantLoadGamePopup.addGoodSizedLabel(ex.localizedMessage).row()
|
||||||
|
cantLoadGamePopup.addCloseButton()
|
||||||
cantLoadGamePopup.open()
|
cantLoadGamePopup.open()
|
||||||
} else {
|
} else {
|
||||||
cantLoadGamePopup.addGoodSizedLabel("If you could copy your game data (\"Copy saved game to clipboard\" - ").row()
|
cantLoadGamePopup.addGoodSizedLabel("If you could copy your game data (\"Copy saved game to clipboard\" - ").row()
|
||||||
cantLoadGamePopup.addGoodSizedLabel(" paste into an email to yairm210@hotmail.com)").row()
|
cantLoadGamePopup.addGoodSizedLabel(" paste into an email to yairm210@hotmail.com)").row()
|
||||||
cantLoadGamePopup.addGoodSizedLabel("I could maybe help you figure out what went wrong, since this isn't supposed to happen!").row()
|
cantLoadGamePopup.addGoodSizedLabel("I could maybe help you figure out what went wrong, since this isn't supposed to happen!").row()
|
||||||
|
cantLoadGamePopup.addCloseButton()
|
||||||
cantLoadGamePopup.open()
|
cantLoadGamePopup.open()
|
||||||
ex.printStackTrace()
|
ex.printStackTrace()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue