mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-22 22:00:24 +07:00
Game can handle resources "disappearing" between versions (esp. for mods)
This commit is contained in:
@ -3,8 +3,8 @@ package com.unciv.build
|
|||||||
object BuildConfig {
|
object BuildConfig {
|
||||||
const val kotlinVersion = "1.4.30"
|
const val kotlinVersion = "1.4.30"
|
||||||
const val appName = "Unciv"
|
const val appName = "Unciv"
|
||||||
const val appCodeNumber = 539
|
const val appCodeNumber = 540
|
||||||
const val appVersion = "3.13.5-patch1"
|
const val appVersion = "3.13.5-patch2"
|
||||||
|
|
||||||
const val gdxVersion = "1.9.14"
|
const val gdxVersion = "1.9.14"
|
||||||
const val roboVMVersion = "2.3.1"
|
const val roboVMVersion = "2.3.1"
|
||||||
|
@ -292,6 +292,7 @@ class GameInfo {
|
|||||||
civInfo.policies.adoptedPolicies.remove("Facism")
|
civInfo.policies.adoptedPolicies.remove("Facism")
|
||||||
civInfo.policies.adoptedPolicies.add("Fascism")
|
civInfo.policies.adoptedPolicies.add("Fascism")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -253,7 +253,8 @@ class DiplomacyManager() {
|
|||||||
fun resourcesFromTrade(): ResourceSupplyList {
|
fun resourcesFromTrade(): ResourceSupplyList {
|
||||||
val counter = ResourceSupplyList()
|
val counter = ResourceSupplyList()
|
||||||
val resourcesMap = civInfo.gameInfo.ruleSet.tileResources
|
val resourcesMap = civInfo.gameInfo.ruleSet.tileResources
|
||||||
val isResourceFilter: (TradeOffer) -> Boolean = { it.type == TradeType.Strategic_Resource || it.type == TradeType.Luxury_Resource }
|
val isResourceFilter: (TradeOffer) -> Boolean = { (it.type == TradeType.Strategic_Resource || it.type == TradeType.Luxury_Resource)
|
||||||
|
&& civInfo.gameInfo.ruleSet.tileResources.containsKey(it.name) }
|
||||||
for (trade in trades) {
|
for (trade in trades) {
|
||||||
for (offer in trade.ourOffers.filter(isResourceFilter))
|
for (offer in trade.ourOffers.filter(isResourceFilter))
|
||||||
counter.add(resourcesMap[offer.name]!!, -offer.amount, "Trade")
|
counter.add(resourcesMap[offer.name]!!, -offer.amount, "Trade")
|
||||||
@ -294,7 +295,7 @@ class DiplomacyManager() {
|
|||||||
|
|
||||||
for (offer in trade.ourOffers) {
|
for (offer in trade.ourOffers) {
|
||||||
if (offer.type in listOf(TradeType.Luxury_Resource, TradeType.Strategic_Resource)
|
if (offer.type in listOf(TradeType.Luxury_Resource, TradeType.Strategic_Resource)
|
||||||
&& offer.name in negativeCivResources) {
|
&& (offer.name in negativeCivResources || !civInfo.gameInfo.ruleSet.tileResources.containsKey(offer.name))) {
|
||||||
trades.remove(trade)
|
trades.remove(trade)
|
||||||
val otherCivTrades = otherCiv().getDiplomacyManager(civInfo).trades
|
val otherCivTrades = otherCiv().getDiplomacyManager(civInfo).trades
|
||||||
otherCivTrades.removeAll { it.equals(trade.reverse()) }
|
otherCivTrades.removeAll { it.equals(trade.reverse()) }
|
||||||
|
Reference in New Issue
Block a user