mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +07:00
Disabled autosave when resizing worldScreen
This commit is contained in:
@ -29,7 +29,6 @@ import com.unciv.models.ruleset.unique.UniqueType
|
|||||||
import com.unciv.ui.cityscreen.CityScreen
|
import com.unciv.ui.cityscreen.CityScreen
|
||||||
import com.unciv.ui.civilopedia.CivilopediaScreen
|
import com.unciv.ui.civilopedia.CivilopediaScreen
|
||||||
import com.unciv.ui.images.ImageGetter
|
import com.unciv.ui.images.ImageGetter
|
||||||
import com.unciv.ui.multiplayer.MultiplayerHelpers
|
|
||||||
import com.unciv.ui.overviewscreen.EmpireOverviewScreen
|
import com.unciv.ui.overviewscreen.EmpireOverviewScreen
|
||||||
import com.unciv.ui.pickerscreens.DiplomaticVotePickerScreen
|
import com.unciv.ui.pickerscreens.DiplomaticVotePickerScreen
|
||||||
import com.unciv.ui.pickerscreens.DiplomaticVoteResultScreen
|
import com.unciv.ui.pickerscreens.DiplomaticVoteResultScreen
|
||||||
@ -748,7 +747,7 @@ class WorldScreen(
|
|||||||
|
|
||||||
override fun resize(width: Int, height: Int) {
|
override fun resize(width: Int, height: Int) {
|
||||||
if (stage.viewport.screenWidth != width || stage.viewport.screenHeight != height) {
|
if (stage.viewport.screenWidth != width || stage.viewport.screenHeight != height) {
|
||||||
startNewScreenJob(gameInfo) // start over
|
startNewScreenJob(gameInfo, true) // start over
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,7 +825,7 @@ class WorldScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** This exists so that no reference to the current world screen remains, so the old world screen can get garbage collected during [UncivGame.loadGame]. */
|
/** This exists so that no reference to the current world screen remains, so the old world screen can get garbage collected during [UncivGame.loadGame]. */
|
||||||
private fun startNewScreenJob(gameInfo: GameInfo) {
|
private fun startNewScreenJob(gameInfo: GameInfo, autosaveDisabled:Boolean = false) {
|
||||||
Concurrency.run {
|
Concurrency.run {
|
||||||
val newWorldScreen = try {
|
val newWorldScreen = try {
|
||||||
UncivGame.Current.loadGame(gameInfo)
|
UncivGame.Current.loadGame(gameInfo)
|
||||||
@ -838,7 +837,8 @@ private fun startNewScreenJob(gameInfo: GameInfo) {
|
|||||||
return@run
|
return@run
|
||||||
}
|
}
|
||||||
|
|
||||||
val shouldAutoSave = gameInfo.turns % UncivGame.Current.settings.turnsBetweenAutosaves == 0
|
val shouldAutoSave = !autosaveDisabled
|
||||||
|
&& gameInfo.turns % UncivGame.Current.settings.turnsBetweenAutosaves == 0
|
||||||
if (shouldAutoSave) {
|
if (shouldAutoSave) {
|
||||||
newWorldScreen.autoSave()
|
newWorldScreen.autoSave()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user