mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-30 15:30:43 -04:00
Hide 'hidden in world screen' resources from overview tab as well
This commit is contained in:
parent
427abfa530
commit
f872150da4
@ -25,7 +25,7 @@ class ResourceSupplyList(
|
|||||||
|
|
||||||
/** Fetch a [ResourceSupply] entry or `null` if no match found */
|
/** Fetch a [ResourceSupply] entry or `null` if no match found */
|
||||||
fun get(resource: TileResource, origin: String) =
|
fun get(resource: TileResource, origin: String) =
|
||||||
firstOrNull { it.resource.name == resource.name && it.origin == origin }
|
firstOrNull { it.resource == resource && it.origin == origin }
|
||||||
|
|
||||||
/** Get the total amount for a resource by [resourceName] */
|
/** Get the total amount for a resource by [resourceName] */
|
||||||
fun sumBy(resourceName: String) =
|
fun sumBy(resourceName: String) =
|
||||||
@ -96,9 +96,7 @@ class ResourceSupplyList(
|
|||||||
*/
|
*/
|
||||||
fun removeAll(origin: String): ResourceSupplyList {
|
fun removeAll(origin: String): ResourceSupplyList {
|
||||||
// The filter creates a separate list so the iteration does not modify concurrently
|
// The filter creates a separate list so the iteration does not modify concurrently
|
||||||
filter { it.origin == origin }.forEach {
|
filter { it.origin == origin }.forEach { remove(it) }
|
||||||
remove(it)
|
|
||||||
}
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import com.unciv.logic.trade.TradeOfferType
|
|||||||
import com.unciv.models.ruleset.tile.ResourceSupplyList
|
import com.unciv.models.ruleset.tile.ResourceSupplyList
|
||||||
import com.unciv.models.ruleset.tile.ResourceType
|
import com.unciv.models.ruleset.tile.ResourceType
|
||||||
import com.unciv.models.ruleset.tile.TileResource
|
import com.unciv.models.ruleset.tile.TileResource
|
||||||
|
import com.unciv.models.ruleset.unique.UniqueType
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.components.UncivTooltip.Companion.addTooltip
|
import com.unciv.ui.components.UncivTooltip.Companion.addTooltip
|
||||||
import com.unciv.ui.components.extensions.addSeparator
|
import com.unciv.ui.components.extensions.addSeparator
|
||||||
@ -56,13 +57,13 @@ class ResourcesOverviewTab(
|
|||||||
|
|
||||||
private val resourceDrilldown: ResourceSupplyList = viewingPlayer.detailedCivResources
|
private val resourceDrilldown: ResourceSupplyList = viewingPlayer.detailedCivResources
|
||||||
private val extraDrilldown: ResourceSupplyList = getExtraDrilldown()
|
private val extraDrilldown: ResourceSupplyList = getExtraDrilldown()
|
||||||
private val drilldownSequence = resourceDrilldown.asSequence() + extraDrilldown.asSequence()
|
private val allResources = ResourceSupplyList().apply { addAll(resourceDrilldown.asSequence() + extraDrilldown.asSequence()) }
|
||||||
|
|
||||||
// Order of source ResourceSupplyList: by tiles, enumerating the map in that spiral pattern
|
// Order of source ResourceSupplyList: by tiles, enumerating the map in that spiral pattern
|
||||||
// UI should not surprise player, thus we need a deterministic and guessable order
|
// UI should not surprise player, thus we need a deterministic and guessable order
|
||||||
private val resources: List<TileResource> = drilldownSequence
|
private val resources: List<TileResource> = allResources.asSequence()
|
||||||
.map { it.resource }
|
.map { it.resource }
|
||||||
.filter { it.resourceType != ResourceType.Bonus }
|
.filter { it.resourceType != ResourceType.Bonus && !it.hasUnique(UniqueType.NotShownOnWorldScreen) }
|
||||||
.distinct()
|
.distinct()
|
||||||
.sortedWith(
|
.sortedWith(
|
||||||
compareBy<TileResource> { it.resourceType }
|
compareBy<TileResource> { it.resourceType }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user