From: "Enrico Weigelt, metux IT consult" <[email protected]>
---
src/net/sf/freecol/common/model/DiplomaticTrade.java | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/net/sf/freecol/common/model/DiplomaticTrade.java
b/src/net/sf/freecol/common/model/DiplomaticTrade.java
index ffb78d5805c..b8150676a4c 100644
--- a/src/net/sf/freecol/common/model/DiplomaticTrade.java
+++ b/src/net/sf/freecol/common/model/DiplomaticTrade.java
@@ -323,8 +323,10 @@ public class DiplomaticTrade extends FreeColGameObject {
* @return The {@code Stance} offered in this trade, or null if none.
*/
public Stance getStance() {
- TradeItem ti = find(this.items, i -> i instanceof StanceTradeItem);
- return (ti == null) ? null : ti.getStance();
+ for (TradeItem ti : this.items)
+ if (ti instanceof StanceTradeItem)
+ return ti.getStance();
+ return null;
}
/**
@@ -349,9 +351,10 @@ public class DiplomaticTrade extends FreeColGameObject {
* @return The gold offered in this trade.
*/
public int getGoldGivenBy(Player player) {
- TradeItem ti = find(this.items, i -> i instanceof GoldTradeItem
- && player == i.getSource());
- return (ti == null) ? -1 : ti.getGold();
+ for (TradeItem ti : this.items)
+ if ((ti instanceof GoldTradeItem) && (player == ti.getSource()))
+ return ti.getGold();
+ return -1;
}
/**
@@ -373,8 +376,10 @@ public class DiplomaticTrade extends FreeColGameObject {
* @return The {@code Player} to be incited against.
*/
public Player getVictim() {
- TradeItem ti = find(this.items, i -> i instanceof InciteTradeItem);
- return (ti == null) ? null : ti.getVictim();
+ for (TradeItem ti : this.items)
+ if (ti instanceof InciteTradeItem)
+ return ti.getVictim();
+ return null;
}
/**
--
2.11.0.rc0.7.gbe5a750
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Freecol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freecol-developers