Resolved #2112 - Show current resource amounts on incoming trade requests
This commit is contained in:
parent
5356e63249
commit
29e25747a8
3 changed files with 15 additions and 4 deletions
|
@ -163,6 +163,7 @@ Introduction to [nation] =
|
|||
Declare war on [nation] =
|
||||
Luxury resources =
|
||||
Strategic resources =
|
||||
Owned: [amountOwned] =
|
||||
|
||||
# Nation picker
|
||||
|
||||
|
|
|
@ -184,9 +184,9 @@ class CityInfo {
|
|||
if (resource.revealedBy!=null && !civInfo.tech.isResearched(resource.revealedBy!!)) return 0
|
||||
|
||||
// Even if the improvement exists (we conquered an enemy city or somesuch) or we have a city on it, we won't get the resource until the correct tech is researched
|
||||
if (resource.improvement!=null){
|
||||
if (resource.improvement!=null) {
|
||||
val improvement = getRuleset().tileImprovements[resource.improvement!!]!!
|
||||
if(improvement.techRequired!=null && !civInfo.tech.isResearched(improvement.techRequired!!)) return 0
|
||||
if (improvement.techRequired != null && !civInfo.tech.isResearched(improvement.techRequired!!)) return 0
|
||||
}
|
||||
|
||||
if (resource.improvement == tileInfo.improvement || tileInfo.isCityCenter()
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.unciv.Constants
|
|||
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
|
||||
import com.unciv.logic.trade.TradeEvaluation
|
||||
import com.unciv.logic.trade.TradeLogic
|
||||
import com.unciv.logic.trade.TradeOffer
|
||||
import com.unciv.logic.trade.TradeType
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.trade.DiplomacyScreen
|
||||
|
@ -34,10 +35,19 @@ class TradePopup(worldScreen: WorldScreen): Popup(worldScreen){
|
|||
tradeOffersTable.add("[${nation.name}]'s trade offer".toLabel())
|
||||
tradeOffersTable.add("Our trade offer".toLabel())
|
||||
tradeOffersTable.row()
|
||||
val ourResources = viewingCiv.getCivResourcesByName()
|
||||
|
||||
fun getOfferText(offer:TradeOffer): String {
|
||||
var tradeText = offer.getOfferText()
|
||||
if (offer.type == TradeType.Luxury_Resource || offer.type == TradeType.Strategic_Resource)
|
||||
tradeText += "\n" + "Owned: [${ourResources[offer.name]}]"
|
||||
return tradeText
|
||||
}
|
||||
|
||||
for(i in 0..max(trade.theirOffers.lastIndex, trade.ourOffers.lastIndex)){
|
||||
if(trade.theirOffers.lastIndex>=i) tradeOffersTable.add(trade.theirOffers[i].getOfferText().toLabel())
|
||||
if(trade.theirOffers.lastIndex>=i) tradeOffersTable.add(getOfferText(trade.theirOffers[i]).toLabel())
|
||||
else tradeOffersTable.add()
|
||||
if(trade.ourOffers.lastIndex>=i) tradeOffersTable.add(trade.ourOffers[i].getOfferText().toLabel())
|
||||
if(trade.ourOffers.lastIndex>=i) tradeOffersTable.add(getOfferText(trade.ourOffers[i]).toLabel())
|
||||
else tradeOffersTable.add()
|
||||
tradeOffersTable.row()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue