From 39ea64b870c41078a6ffb7b783bcefed2aa9dfbd Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 26 Dec 2017 21:50:47 +0200 Subject: [PATCH] Fixed bugs --- core/src/com/unciv/civinfo/CityConstructions.java | 3 +-- core/src/com/unciv/civinfo/CityInfo.java | 6 +++--- core/src/com/unciv/civinfo/CivilizationInfo.java | 5 ++++- core/src/com/unciv/game/CityScreen.java | 2 +- core/src/com/unciv/game/WorldScreen.java | 7 ++++--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/core/src/com/unciv/civinfo/CityConstructions.java b/core/src/com/unciv/civinfo/CityConstructions.java index b499ed97b6..fdeef59a91 100644 --- a/core/src/com/unciv/civinfo/CityConstructions.java +++ b/core/src/com/unciv/civinfo/CityConstructions.java @@ -23,7 +23,6 @@ public class CityConstructions public CityConstructions(CityInfo cityInfo) { cityLocation = cityInfo.cityLocation; - chooseNextConstruction(); } public LinqCollection builtBuildings = new LinqCollection(); @@ -84,7 +83,7 @@ public class CityConstructions } - private void chooseNextConstruction() { + void chooseNextConstruction() { currentConstruction = getBuildableBuildings().first(new Predicate() { @Override public boolean evaluate(String arg0) { diff --git a/core/src/com/unciv/civinfo/CityInfo.java b/core/src/com/unciv/civinfo/CityInfo.java index 25083f7cdb..4b2d6bef46 100644 --- a/core/src/com/unciv/civinfo/CityInfo.java +++ b/core/src/com/unciv/civinfo/CityInfo.java @@ -57,12 +57,12 @@ public class CityInfo { CityInfo(CivilizationInfo civInfo, Vector2 cityLocation) { name = CityNames[civInfo.cities.size()]; this.cityLocation = cityLocation; + civInfo.cities.add(this); cityConstructions = new CityConstructions(this); if(civInfo.cities.size()==0) { cityConstructions.builtBuildings.add("Palace"); cityConstructions.currentConstruction = "Worker"; // Default for first city only! } - civInfo.cities.add(this); for(TileInfo tileInfo : civInfo.tileMap.getTilesInDistance(cityLocation,1)) { tileInfo.owner = civInfo.civName; @@ -194,8 +194,8 @@ public class CityInfo { statPercentBonuses.science+=15; stats.production*=1+statPercentBonuses.production/100; // So they get bonuses for production and gold/science - if(cityConstructions.currentConstruction.equals("Gold")) stats.gold+=stats.production/4; - if(cityConstructions.currentConstruction.equals("Science")) { + if("Gold".equals(cityConstructions.currentConstruction)) stats.gold+=stats.production/4; + if("Science".equals(cityConstructions.currentConstruction)) { float scienceProduced=stats.production/4; if (civInfo.getBuildingUniques().contains("ScienceConversionIncrease")) scienceProduced*=1.33; diff --git a/core/src/com/unciv/civinfo/CivilizationInfo.java b/core/src/com/unciv/civinfo/CivilizationInfo.java index 652942f08e..11d496cfa3 100644 --- a/core/src/com/unciv/civinfo/CivilizationInfo.java +++ b/core/src/com/unciv/civinfo/CivilizationInfo.java @@ -52,7 +52,8 @@ public class CivilizationInfo { } public void addCity(Vector2 location){ - new CityInfo(this,location); + CityInfo newCity = new CityInfo(this,location); + newCity.cityConstructions.chooseNextConstruction(); } public CityInfo getCapital(){ @@ -151,11 +152,13 @@ public class CivilizationInfo { int transportationUpkeep = 0; for(TileInfo tile : tileMap.values()) { + if(tile.isCityCenter()) continue; if (tile.roadStatus == RoadStatus.Road) transportationUpkeep+=1; else if(tile.roadStatus == RoadStatus.Railroad) transportationUpkeep+=2; } if(policies.contains("Trade Unions")) transportationUpkeep *= 2/3f; statsForTurn.gold -=transportationUpkeep; + if(policies.contains("Mandate Of Heaven")) statsForTurn.culture+=getHappinessForNextTurn()/2; return statsForTurn; diff --git a/core/src/com/unciv/game/CityScreen.java b/core/src/com/unciv/game/CityScreen.java index ff45903ea2..4f156cb2a0 100644 --- a/core/src/com/unciv/game/CityScreen.java +++ b/core/src/com/unciv/game/CityScreen.java @@ -96,7 +96,7 @@ public class CityScreen extends CameraStageBaseScreen { private Image getSpecialistIcon(String imageName, final boolean isFilled, final FullStats specialistType) { Image specialist = ImageGetter.getImage(imageName); - specialist.setSize(20,20); + specialist.setSize(30,30); if(!isFilled) specialist.setColor(Color.GRAY); specialist.addListener(new ClickListener(){ @Override diff --git a/core/src/com/unciv/game/WorldScreen.java b/core/src/com/unciv/game/WorldScreen.java index 8827b3050f..6980a553c7 100644 --- a/core/src/com/unciv/game/WorldScreen.java +++ b/core/src/com/unciv/game/WorldScreen.java @@ -261,10 +261,11 @@ public class WorldScreen extends CameraStageBaseScreen { Label happinessLabel = new Label(happinessText, skin); happinessLabel.setAlignment(Align.center); civTable.add(happinessLabel); - String cultureString = "Culture: " + Math.round(currentStats.culture) + "(+" + Math.round(nextTurnStats.culture) +")\r\n" + String cultureString = "Culture: " + "+" + Math.round(nextTurnStats.culture) +"\r\n" +"("+ ((int) game.civInfo.civStats.culture)+"/"+game.civInfo.getCultureNeededForNextPolicy()+")"; - - civTable.add(new Label(cultureString, skin)); + Label cultureLabel = new Label(cultureString, skin); + cultureLabel.setAlignment(Align.center); + civTable.add(cultureLabel); civTable.pack();