mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
fix: loading a game would load the oldest backup save
This commit is contained in:
@@ -67,17 +67,26 @@ class SavegameCollectionPair(player: SavegameCollection?, world: SavegameCollect
|
|||||||
val wcf = world.files[wc]
|
val wcf = world.files[wc]
|
||||||
val wcm = wcf.getLastModifiedTime()
|
val wcm = wcf.getLastModifiedTime()
|
||||||
|
|
||||||
|
printdbg(this, "pc=$pc, wc=$wc, pcm=$pcm, wcm=$wcm")
|
||||||
|
|
||||||
if (playerDiskNotDamaged(pcf) && worldDiskNotDamaged(wcf)) {
|
if (playerDiskNotDamaged(pcf) && worldDiskNotDamaged(wcf)) {
|
||||||
|
|
||||||
|
printdbg(this, "pcf.autosaved=${pcf.isAutosaved()}, wcf.autosaved=${wcf.isAutosaved()}")
|
||||||
|
|
||||||
when (pcf.isAutosaved().toInt(1) or wcf.isAutosaved().toInt()) {
|
when (pcf.isAutosaved().toInt(1) or wcf.isAutosaved().toInt()) {
|
||||||
3 -> {
|
3 -> {
|
||||||
autoPlayer = pcf
|
if (!::autoPlayer.isInitialized && !::autoWorld.isInitialized) {
|
||||||
autoWorld = wcf
|
autoPlayer = pcf
|
||||||
|
autoWorld = wcf
|
||||||
|
}
|
||||||
pc += 1
|
pc += 1
|
||||||
wc += 1
|
wc += 1
|
||||||
}
|
}
|
||||||
0 -> {
|
0 -> {
|
||||||
manualPlayer = pcf
|
if (!::manualPlayer.isInitialized && !::manualWorld.isInitialized) {
|
||||||
manualWorld = wcf
|
manualPlayer = pcf
|
||||||
|
manualWorld = wcf
|
||||||
|
}
|
||||||
pc += 1
|
pc += 1
|
||||||
wc += 1
|
wc += 1
|
||||||
}
|
}
|
||||||
@@ -92,7 +101,6 @@ class SavegameCollectionPair(player: SavegameCollection?, world: SavegameCollect
|
|||||||
wc += 1
|
wc += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,14 @@ class UIWorldPortal : UICanvas(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun cleanUpWorldDict() {
|
||||||
|
// remove dupes, etc
|
||||||
|
INGAME.actorNowPlaying?.let {
|
||||||
|
val avList = (it.actorValue.getAsString(AVKey.WORLD_PORTAL_DICT) ?: "").split(',').filter { it.isNotBlank() }.toSet()
|
||||||
|
it.actorValue[AVKey.WORLD_PORTAL_DICT] = avList.joinToString(",")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
super.show()
|
super.show()
|
||||||
transitionPanel.forcePosition(0)
|
transitionPanel.forcePosition(0)
|
||||||
@@ -117,6 +125,7 @@ class UIWorldPortal : UICanvas(
|
|||||||
|
|
||||||
// add current world to the player's worldportaldict
|
// add current world to the player's worldportaldict
|
||||||
addWorldToPlayersDict(INGAME.world.worldIndex)
|
addWorldToPlayersDict(INGAME.world.worldIndex)
|
||||||
|
cleanUpWorldDict()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hide() {
|
override fun hide() {
|
||||||
|
|||||||
Reference in New Issue
Block a user