double-click on worked tile icon locks tile, for worked tiles as well!

This commit is contained in:
Yair Morgenstern 2023-07-31 11:17:23 +03:00
parent 19f0cadb1e
commit 15577cb3c5

View File

@ -1,6 +1,5 @@
package com.unciv.ui.screens.cityscreen
import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.badlogic.gdx.scenes.scene2d.ui.Table
@ -353,7 +352,7 @@ class CityScreen(
if (!canChangeState || city.isPuppet) return
val tile = tileGroup.tile
// Cycling as: Not-worked -> Worked -> Locked -> Not-worked
// Cycling as: Not-worked -> Worked -> Not-worked
if (tileGroup.tileState == CityTileState.WORKABLE) {
if (!tile.providesYield() && city.population.getFreePopulation() > 0) {
city.workedTiles.add(tile.position)
@ -404,6 +403,11 @@ class CityScreen(
if (!canChangeState || city.isPuppet || tileGroup.tileState != CityTileState.WORKABLE) return
val tile = tileGroup.tile
// Double-click should lead to locked tiles - both for unworked AND worked tiles
if (!tile.isWorked()) // If not worked, try to work it first
tileWorkedIconOnClick(tileGroup, city)
if (tile.isWorked())
city.lockedTiles.add(tile.position)