When you have the "claimsMustBeConnected" option enabled, it now works on a world-by-world basis, so if you have claims in one world you can still make claims in other worlds

This commit is contained in:
Brettflan 2011-06-30 06:13:47 -05:00
parent 8f1606beba
commit 94d1dc210c
3 changed files with 18 additions and 1 deletions

View File

@ -120,6 +120,19 @@ public class Board {
return getFactionCoordCount(faction.getId()); return getFactionCoordCount(faction.getId());
} }
public static int getFactionCoordCountInWorld(Faction faction, String worldName) {
int factionId = faction.getId();
int ret = 0;
Iterator<Entry<FLocation, Integer>> iter = flocationIds.entrySet().iterator();
while (iter.hasNext()) {
Entry<FLocation, Integer> entry = iter.next();
if (entry.getValue() == factionId && entry.getKey().getWorldName().equals(worldName)) {
ret += 1;
}
}
return ret;
}
//----------------------------------------------// //----------------------------------------------//
// Map generation // Map generation
//----------------------------------------------// //----------------------------------------------//

View File

@ -506,7 +506,7 @@ public class FPlayer {
return false; return false;
} }
if (Conf.claimsMustBeConnected && myFaction.getLandRounded() > 0 && !Board.isConnectedLocation(flocation, myFaction)) { if (Conf.claimsMustBeConnected && myFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && !Board.isConnectedLocation(flocation, myFaction)) {
sendMessage("You can only claim additional land which is connected to your first claim!"); sendMessage("You can only claim additional land which is connected to your first claim!");
return false; return false;
} }

View File

@ -225,6 +225,10 @@ public class Faction {
return Board.getFactionCoordCount(this); return Board.getFactionCoordCount(this);
} }
public int getLandRoundedInWorld(String worldName) {
return Board.getFactionCoordCountInWorld(this, worldName);
}
public boolean hasLandInflation() { public boolean hasLandInflation() {
return this.getLandRounded() > this.getPowerRounded(); return this.getLandRounded() > this.getPowerRounded();
} }