From: "Enrico Weigelt, metux IT consult" <[email protected]>
---
src/net/sf/freecol/common/model/Colony.java | 31 ++++++++++++++++++-----------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/src/net/sf/freecol/common/model/Colony.java
b/src/net/sf/freecol/common/model/Colony.java
index 93c1a4ed575..df4d3e387ef 100644
--- a/src/net/sf/freecol/common/model/Colony.java
+++ b/src/net/sf/freecol/common/model/Colony.java
@@ -2045,18 +2045,25 @@ public class Colony extends Settlement implements
Nameable, TradeLocation {
* @return True if the goods can be produced.
*/
public boolean canProduce(GoodsType goodsType) {
- return (getNetProductionOf(goodsType) > 0)
- ? true // Obviously:-)
-
- // Breeding requires the breedable number to be present
- : (goodsType.isBreedable())
- ? getGoodsCount(goodsType) >= goodsType.getBreedingNumber()
-
- // Is there a work location that can produce the goods, with
- // positive generic production potential and all inputs
satisfied?
- : any(getWorkLocationsForProducing(goodsType),
- wl -> wl.getGenericPotential(goodsType) > 0
- && all(wl.getInputs(), ag ->
canProduce(ag.getType())));
+ if (getNetProductionOf(goodsType) > 0) return true; // Obviously:-)
+
+ // Breeding requires the breedable number to be present
+ if (goodsType.isBreedable())
+ return getGoodsCount(goodsType) >= goodsType.getBreedingNumber();
+
+ // Is there a work location that can produce the goods, with
+ // positive generic production potential and all inputs satisfied?
+loop: for (WorkLocation wl : getWorkLocationsForProducing(goodsType)) {
+ if (wl.getGenericPotential(goodsType) > 0) {
+ for (AbstractGoods ag : wl.getInputs()) {
+ if (!canProduce(ag.getType()))
+ continue loop;
+ }
+ return true;
+ }
+ }
+
+ return false;
}
--
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