mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 21:11:35 +07:00
Visual indicator for building outside workable tiles 9486 (#9935)
* Added warning to improvement picker buttons for improvements out of range for population to work City population can not work tiles farther than 3 tiles from the city center. The improvement picker did not warn that improvements providing stat increases would not be workable, so the improvement might be worthless. The ImprovementPicker screen will now warn on the improvement button if the improvement provides a stat increase, but is farther than 3 tiles from the owning city center. The warning happens for all improvements that increase the tile stats, including Luxury and Strategic resource improvements. The warning does not disallow building the improvement. * Changed methods for finding positive stat increases and added translation for warning text * Condensed conditional for warning text in ImprovementPicker
This commit is contained in:
parent
f3ff1033ea
commit
f7415bf0a9
@ -1172,6 +1172,7 @@ Pick improvement =
|
||||
Provides [resource] =
|
||||
Provides [amount] [resource] =
|
||||
Replaces [improvement] =
|
||||
Not in city work range =
|
||||
Pick now! =
|
||||
Remove [feature] first =
|
||||
Research [tech] first =
|
||||
|
@ -163,6 +163,18 @@ class ImprovementPickerScreen(
|
||||
tile.getCity(),
|
||||
cityUniqueCache
|
||||
)
|
||||
|
||||
//Warn when the current improvement will increase a stat for the tile,
|
||||
// but the tile is outside of the range (> 3 tiles from city center) that can be
|
||||
// worked by a city's population
|
||||
if (stats.values.any { it > 0f }
|
||||
&& !improvement.name.startsWith(Constants.remove)
|
||||
&& !improvement.isRoad()
|
||||
&& tile.owningCity != null
|
||||
&& !tile.owningCity!!.getWorkableTiles().contains(tile)
|
||||
)
|
||||
labelText += "\n" + "Not in city work range".tr()
|
||||
|
||||
val statsTable = getStatsTable(stats)
|
||||
statIcons.add(statsTable).padLeft(13f)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user