mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
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:
parent
3869f8e4a5
commit
5e685e10aa
@ -1,6 +1,7 @@
|
|||||||
package com.unciv.models.ruleset.validation
|
package com.unciv.models.ruleset.validation
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
|
import com.badlogic.gdx.files.FileHandle
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData
|
||||||
import com.unciv.Constants
|
import com.unciv.Constants
|
||||||
@ -755,6 +756,11 @@ class RulesetValidator(val ruleset: Ruleset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun checkTilesetSanity(lines: RulesetErrorList) {
|
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")
|
val tilesetConfigFolder = (ruleset.folderLocation ?: Gdx.files.internal("")).child("jsons\\TileSets")
|
||||||
if (!tilesetConfigFolder.exists()) return
|
if (!tilesetConfigFolder.exists()) return
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@ import com.unciv.UncivGame
|
|||||||
import com.unciv.models.metadata.GameSettings
|
import com.unciv.models.metadata.GameSettings
|
||||||
import com.unciv.ui.components.ZoomGestureListener
|
import com.unciv.ui.components.ZoomGestureListener
|
||||||
import com.unciv.ui.components.input.KeyboardPanningListener
|
import com.unciv.ui.components.input.KeyboardPanningListener
|
||||||
import java.lang.Float.max
|
|
||||||
import java.lang.Float.min
|
|
||||||
import kotlin.math.sqrt
|
import kotlin.math.sqrt
|
||||||
|
|
||||||
|
|
||||||
@ -138,7 +136,7 @@ open class ZoomableScrollPane(
|
|||||||
}
|
}
|
||||||
|
|
||||||
open fun zoom(zoomScale: Float) {
|
open fun zoom(zoomScale: Float) {
|
||||||
val newZoom = min(max(zoomScale, minZoom), maxZoom)
|
val newZoom = zoomScale.coerceIn(minZoom, maxZoom)
|
||||||
val oldZoomX = scaleX
|
val oldZoomX = scaleX
|
||||||
val oldZoomY = scaleY
|
val oldZoomY = scaleY
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user