Added a popup when trying and faiing to load a game, so people will send me emails when this happens

This commit is contained in:
Yair Morgenstern 2019-03-10 23:13:04 +02:00
parent 881f532bf7
commit aea7d750fd
3 changed files with 13 additions and 3 deletions

View File

@ -96,7 +96,7 @@ class CityExpansionManager {
}
fun takeOwnership(tileInfo: TileInfo){
if(tileInfo.isCityCenter()) throw Exception("What?")
if(tileInfo.isCityCenter()) throw Exception("What?!")
if(tileInfo.getCity()!=null) tileInfo.getCity()!!.expansion.relinquishOwnership(tileInfo)
cityInfo.tiles = cityInfo.tiles.withItem(tileInfo.position)

View File

@ -11,6 +11,7 @@ import com.unciv.logic.GameSaver
import com.unciv.models.gamebasics.tr
import com.unciv.ui.pickerscreens.PickerScreen
import com.unciv.ui.utils.*
import com.unciv.ui.worldscreen.optionstable.PopupTable
import java.text.SimpleDateFormat
import java.util.*
@ -91,8 +92,17 @@ class LoadScreen : PickerScreen() {
topTable.add(rightSideTable)
rightSideButton.onClick {
try {
UnCivGame.Current.loadGame(selectedSave)
}
catch (ex:Exception){
val popup = PopupTable(this)
popup.addGoodSizedLabel("It looks like your saved game can't be loaded!")
popup.addGoodSizedLabel("If you could copy your game data (\"Copy saved game to clipboard\" - paste into an email to yairm210@hotmail.com)")
popup.addGoodSizedLabel("I could maybe help you figure out what went wrong, since this isn't supposed to happen!")
popup.open()
}
}
}

View File

@ -29,7 +29,7 @@ class IdleUnitButton (internal val unitTable: UnitTable,
enable()
onClick {
val tilesWithIdleUnits = getTilesWithIdleUnits()
if(tilesWithIdleUnits.isEmpty()) return@onClick
val tileToSelect: TileInfo
if (unitTable.selectedUnit==null || !tilesWithIdleUnits.contains(unitTable.selectedUnit!!.getTile()))
tileToSelect = tilesWithIdleUnits[0]