Skip to content

Commit

Permalink
chore: remove dead loadScenario function (happens via new game screen)
Browse files Browse the repository at this point in the history
  • Loading branch information
yairm210 committed Dec 30, 2024
1 parent 38b44ec commit ba9bb4a
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions core/src/com/unciv/logic/files/UncivFiles.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.badlogic.gdx.files.FileHandle
import com.badlogic.gdx.utils.GdxRuntimeException
import com.badlogic.gdx.utils.JsonReader
import com.badlogic.gdx.utils.SerializationException
import com.unciv.Constants
import com.unciv.UncivGame
import com.unciv.json.fromJsonFile
import com.unciv.json.json
Expand All @@ -16,8 +15,6 @@ import com.unciv.logic.GameInfoPreview
import com.unciv.logic.GameInfoSerializationVersion
import com.unciv.logic.HasGameInfoSerializationVersion
import com.unciv.logic.UncivShowableException
import com.unciv.logic.civilization.PlayerType
import com.unciv.logic.civilization.managers.TurnManager
import com.unciv.models.metadata.GameSettings
import com.unciv.models.metadata.doMigrations
import com.unciv.models.metadata.isMigrationNecessary
Expand Down Expand Up @@ -321,11 +318,10 @@ class UncivFiles(
}

//endregion

//region Scenarios

val scenarioFolder = "scenarios"
fun getScenarioFiles() = sequence {

for (mod in RulesetCache.values) {
val modFolder = mod.folderLocation ?: continue
val scenarioFolder = modFolder.child(scenarioFolder)
Expand All @@ -334,22 +330,6 @@ class UncivFiles(
yield(Pair(file, mod))
}
}

fun loadScenario(gameFile: FileHandle): GameInfo {
val game = loadGameFromFile(gameFile)
game.civilizations.removeAll { it.isSpectator() }
for (civ in game.civilizations)
civ.diplomacy.remove(Constants.spectator)
if (game.civilizations.none { it.isHuman() })
game.civilizations.first { it.isMajorCiv() }.playerType = PlayerType.Human

game.currentPlayerCiv = game.civilizations.first { it.playerType == PlayerType.Human }
game.currentPlayer = game.currentPlayerCiv.civName
TurnManager(game.currentPlayerCiv).startTurn()

return game
}

//endregion

//region Mod caching
Expand Down

0 comments on commit ba9bb4a

Please sign in to comment.