mirror of https://github.com/FreeCol/freecol.git
Fix claiming land prior to working a tile.
This commit is contained in:
parent
ba28a866d5
commit
a78e9958ac
|
@ -4253,7 +4253,8 @@ public final class InGameController implements NetworkConstants {
|
|||
|
||||
Tile tile = unit.getTile();
|
||||
if (player != tile.getOwner()) {
|
||||
if (!claimLand(tile, null, 0)) return;
|
||||
if (!claimTile(player, tile, null, player.getLandPrice(tile), 0)
|
||||
|| player != tile.getOwner()) return;
|
||||
}
|
||||
|
||||
if (askChangeWorkImprovementType(unit, improvementType)) {
|
||||
|
|
|
@ -1150,6 +1150,19 @@ public class Player extends FreeColGameObject implements Nameable {
|
|||
return owner == null || owner == this || getLandPrice(tile) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can a tile be acquired from its owners and used for an improvement?
|
||||
* Slightly weakens canClaimForImprovement to allow for purchase
|
||||
* and/or stealing.
|
||||
*
|
||||
* @param tile The <code>Tile</code> to consider.
|
||||
* @return True if the tile ownership can be claimed.
|
||||
*/
|
||||
public boolean canAcquireForImprovement(Tile tile) {
|
||||
return canClaimForImprovement(tile)
|
||||
|| getLandPrice(tile) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>Unit</code> value.
|
||||
*
|
||||
|
|
|
@ -2466,7 +2466,7 @@ public class Unit extends FreeColGameObject implements Locatable, Location, Owna
|
|||
return getState() == UnitState.FORTIFYING;
|
||||
case IMPROVING:
|
||||
if (location instanceof Tile
|
||||
&& getOwner().canClaimForImprovement(location.getTile())) {
|
||||
&& getOwner().canAcquireForImprovement(location.getTile())) {
|
||||
return getMovesLeft() > 0;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue