policy picker screen now opens rom boolean

This commit is contained in:
Yair Morgenstern 2018-01-23 21:52:25 +02:00
parent b6d235a4d0
commit 561fd417ed
4 changed files with 15 additions and 5 deletions

View File

@ -16,6 +16,7 @@ public class PolicyManager {
public int freePolicies=0;
public int storedCulture=0;
private Linq<String> adoptedPolicies = new Linq<String>();
public boolean shouldOpenPolicyPicker=false;
public Linq<String> getAdoptedPolicies(){return adoptedPolicies.clone();}
public boolean isAdopted(String policyName){return adoptedPolicies.contains(policyName);}
@ -85,9 +86,9 @@ public class PolicyManager {
}
public void nextTurn(float culture) {
storedCulture+=culture;
boolean couldAdoptPolicyBefore = canAdoptPolicy();
storedCulture+=culture;
if(!couldAdoptPolicyBefore && canAdoptPolicy())
UnCivGame.Current.setScreen(new PolicyPickerScreen());
shouldOpenPolicyPicker=true;
}
}

View File

@ -62,11 +62,12 @@ public class MapUnit{
public TileInfo findTileToWork(TileInfo currentTile){
TileInfo selectedTile = currentTile;
int tilePriority = getPriority(currentTile);
int tilePriority = currentTile.improvement==null && currentTile.canBuildImprovement(chooseImprovement(currentTile))
? getPriority(currentTile) : 1; // min rank to get selected is 2
for (int i = 1; i < 5; i++)
for (TileInfo tile : CivilizationInfo.current().tileMap.getTilesAtDistance(currentTile.position,i))
if(tile.unit==null && tile.improvement==null && getPriority(tile)>tilePriority
&& tile.canBuildImprovement(GameBasics.TileImprovements.get(chooseImprovement(tile)))){
&& tile.canBuildImprovement(chooseImprovement(tile))){
selectedTile = tile;
tilePriority = getPriority(tile);
}
@ -83,7 +84,7 @@ public class MapUnit{
}
if(tile.improvementInProgress == null){
String improvement =chooseImprovement(tile);
if(tile.canBuildImprovement(GameBasics.TileImprovements.get(improvement))) // What if we're stuck on this tile but can't build there?
if(tile.canBuildImprovement(improvement)) // What if we're stuck on this tile but can't build there?
tile.startWorkingOnImprovement(improvement);
}
}

View File

@ -106,6 +106,10 @@ public class TileInfo
return stats;
}
public boolean canBuildImprovement(String improvementName){
return canBuildImprovement(GameBasics.TileImprovements.get(improvementName));
}
public boolean canBuildImprovement(TileImprovement improvement)
{
if(isCityCenter() || improvement.name.equals(this.improvement)) return false;

View File

@ -192,6 +192,10 @@ public class WorldScreen extends CameraStageBaseScreen {
if (game.civInfo.tech.freeTechs != 0) {
game.setScreen(new TechPickerScreen(true));
}
else if(game.civInfo.policies.shouldOpenPolicyPicker){
game.setScreen(new PolicyPickerScreen());
game.civInfo.policies.shouldOpenPolicyPicker=false;
}
}