Resolved #12506 - debug option to show tile image locations
Some checks failed
Conflict marking / main (push) Failing after 19s
Detekt / detekt (ubuntu-latest) (push) Failing after 1m0s
Generate mkdocs from docs folder / deploy (push) Failing after 24s
Build and test / Check code and run unit tests (push) Failing after 35m3s
Close stale issues and PRs / stale (push) Successful in 14s
Docker / build (push) Failing after 1m8s

This commit is contained in:
yairm210
2024-11-25 17:00:48 +02:00
parent 9dc1d5b4f1
commit d91319b792
4 changed files with 13 additions and 3 deletions

View File

@ -20,7 +20,7 @@ class TileLayerTerrain(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
override fun hit(x: Float, y: Float, touchable: Boolean): Actor? = null
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
private val tileBaseImages: ArrayList<Image> = ArrayList()
val tileBaseImages: ArrayList<Image> = ArrayList()
private var tileImageIdentifiers = listOf<String>()
private var bottomRightRiverImage: Image? = null
private var bottomRiverImage: Image? = null
@ -155,6 +155,7 @@ class TileLayerTerrain(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
val finalLocation = existingImages.random(
Random(tileGroup.tile.position.hashCode() + locationToCheck.hashCode()))
val image = ImageGetter.getImage(finalLocation)
image.name = finalLocation // for debug mode reveal
tileBaseImages.add(image)
addActor(image)

View File

@ -58,6 +58,9 @@ fun debugTab(
add("Show coordinates on tiles".toCheckBox(DebugUtils.SHOW_TILE_COORDS) {
DebugUtils.SHOW_TILE_COORDS = it
}).colspan(2).row()
add("Show tile image locations".toCheckBox(DebugUtils.SHOW_TILE_IMAGE_LOCATIONS) {
DebugUtils.SHOW_TILE_IMAGE_LOCATIONS = it
}).colspan(2).row()
val curGameInfo = game.gameInfo
if (curGameInfo != null) {

View File

@ -38,8 +38,12 @@ class TileInfoTable(private val worldScreen: WorldScreen) : Table(BaseScreen.ski
add(MarkupRenderer.render(TileDescription.toMarkup(tile, selectedCiv), padding = 0f, iconDisplay = IconDisplay.None) {
worldScreen.openCivilopedia(it)
} ).pad(5f).row()
if (DebugUtils.VISIBLE_MAP)
add(tile.position.toPrettyString().toLabel()).colspan(2).pad(5f)
if (DebugUtils.VISIBLE_MAP) add(tile.position.toPrettyString().toLabel()).colspan(2).pad(5f)
if (DebugUtils.SHOW_TILE_IMAGE_LOCATIONS){
val imagesString = "Images: " + worldScreen.mapHolder.tileGroups[tile]!!.layerTerrain.tileBaseImages.joinToString{"\n"+it.name}
add(imagesString.toLabel())
}
}
pack()

View File

@ -11,6 +11,8 @@ object DebugUtils {
/** This flag paints the tile coordinates directly onto the map tiles. */
var SHOW_TILE_COORDS: Boolean = false
var SHOW_TILE_IMAGE_LOCATIONS: Boolean = false
/** For when you need to test something in an advanced game and don't have time to faff around */
var SUPERCHARGED: Boolean = false