From: <aba...@us...> - 2008-12-27 22:18:52
|
Revision: 4767 http://freecol.svn.sourceforge.net/freecol/?rev=4767&view=rev Author: abartels Date: 2008-12-27 22:18:45 +0000 (Sat, 27 Dec 2008) Log Message: ----------- Fish bonus may still change if the tile has unexplored neighbours. Set final value only if all adjacent tiles have already been explored, otherwise return temporary calculation. Modified Paths: -------------- freecol/trunk/src/net/sf/freecol/common/model/Tile.java Modified: freecol/trunk/src/net/sf/freecol/common/model/Tile.java =================================================================== --- freecol/trunk/src/net/sf/freecol/common/model/Tile.java 2008-12-27 20:28:10 UTC (rev 4766) +++ freecol/trunk/src/net/sf/freecol/common/model/Tile.java 2008-12-27 22:18:45 UTC (rev 4767) @@ -877,16 +877,20 @@ */ public int getFishBonus() { if (fishBonus < 0) { - fishBonus = 0; + int tempFishBonus = 0; + boolean bonusIsFinal = true; if (!isLand()) { Iterator<Position> tileIterator = getMap().getAdjacentIterator(getPosition()); while (tileIterator.hasNext()) { Tile t = getMap().getTile(tileIterator.next()); + if (!t.isExplored()) { + bonusIsFinal = false; + } if (t.isLand()) { - fishBonus++; + tempFishBonus++; } if (t.hasRiver()) { - fishBonus += t.getRiver().getMagnitude(); + tempFishBonus += t.getRiver().getMagnitude(); } } } @@ -894,8 +898,14 @@ // trying to do work for some other player, and the tile // has not yet been explored. if (type != null && !type.isConnected()) { - fishBonus = fishBonus / 2; + tempFishBonus = tempFishBonus / 2; } + + //set final bonus only if all adjacent tiles have been explored + if (bonusIsFinal) { + fishBonus = tempFishBonus; + } + return tempFishBonus; } return fishBonus; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |