Fix tileset sanity check for builtin rulesets when run from jar (#11230)

* Avoid using folder listing for tileset sanity checks for builtin rulesets from jar

* Remove an unnecessary java import

* Revert the builtin-tileset-within-jar special check, not necessary for a release
This commit is contained in:
SomeTroglodyte 2024-03-03 19:03:40 +01:00 committed by GitHub
parent 3869f8e4a5
commit 5e685e10aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package com.unciv.models.ruleset.validation
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.files.FileHandle
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData
import com.unciv.Constants
@ -755,6 +756,11 @@ class RulesetValidator(val ruleset: Ruleset) {
}
private fun checkTilesetSanity(lines: RulesetErrorList) {
// If running from a jar *and* checking a builtin ruleset, skip this check.
// - We can't list() the jsons, and the unit test before relase is sufficient, the tileset config can't have changed since then.
if (ruleset.folderLocation == null && this::class.java.`package`?.specificationVersion != null)
return
val tilesetConfigFolder = (ruleset.folderLocation ?: Gdx.files.internal("")).child("jsons\\TileSets")
if (!tilesetConfigFolder.exists()) return

View File

@ -19,8 +19,6 @@ import com.unciv.UncivGame
import com.unciv.models.metadata.GameSettings
import com.unciv.ui.components.ZoomGestureListener
import com.unciv.ui.components.input.KeyboardPanningListener
import java.lang.Float.max
import java.lang.Float.min
import kotlin.math.sqrt
@ -138,7 +136,7 @@ open class ZoomableScrollPane(
}
open fun zoom(zoomScale: Float) {
val newZoom = min(max(zoomScale, minZoom), maxZoom)
val newZoom = zoomScale.coerceIn(minZoom, maxZoom)
val oldZoomX = scaleX
val oldZoomY = scaleY