diff --git a/core/src/com/unciv/logic/city/CityInfo.java b/core/src/com/unciv/logic/city/CityInfo.java index b17c6fad09..6269543f83 100644 --- a/core/src/com/unciv/logic/city/CityInfo.java +++ b/core/src/com/unciv/logic/city/CityInfo.java @@ -68,7 +68,7 @@ public class CityInfo { TileInfo tile = getTile(); tile.workingCity = this.name; tile.roadStatus = RoadStatus.Railroad; - if("Forest".equals(tile.terrainFeature) || "Jungle".equals(tile.terrainFeature) || "Marsh".equals(tile.terrainFeature)) + if(new Linq("Forest","Jungle","Marsh").contains(tile.terrainFeature)) tile.terrainFeature=null; population.autoAssignWorker(); diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.java b/core/src/com/unciv/logic/civilization/CivilizationInfo.java index 3df6460e16..469aff7179 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.java +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.java @@ -2,6 +2,7 @@ package com.unciv.logic.civilization; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Predicate; +import com.sun.jmx.remote.security.NotificationAccessController; import com.unciv.logic.city.CityInfo; import com.unciv.logic.map.RoadStatus; import com.unciv.logic.map.TileInfo; @@ -36,15 +37,7 @@ public class CivilizationInfo { public GreatPersonManager greatPeople = new GreatPersonManager(); public int turns = 1; - public class Notification{ - public final String text; - public final Vector2 location; - Notification(String text, Vector2 location) { - this.text = text; - this.location = location; - } - } public Linq notifications = new Linq(); public void addNotification(String text, Vector2 location){ notifications.add(new Notification(text,location)); diff --git a/core/src/com/unciv/logic/civilization/Notification.java b/core/src/com/unciv/logic/civilization/Notification.java new file mode 100644 index 0000000000..4ec08c64f1 --- /dev/null +++ b/core/src/com/unciv/logic/civilization/Notification.java @@ -0,0 +1,15 @@ +package com.unciv.logic.civilization; + +import com.badlogic.gdx.math.Vector2; + +public class Notification{ + public String text; + public Vector2 location; + + Notification(){} + + Notification(String text, Vector2 location) { + this.text = text; + this.location = location; + } +} diff --git a/core/src/com/unciv/logic/map/MapUnit.java b/core/src/com/unciv/logic/map/MapUnit.java index 520092140e..aaecdd6eee 100644 --- a/core/src/com/unciv/logic/map/MapUnit.java +++ b/core/src/com/unciv/logic/map/MapUnit.java @@ -24,8 +24,9 @@ public class MapUnit{ if(currentMovement!=0) doAction(gotTo); return; } + + if ("automation".equals(action)) {doAutomatedAction(tile);return;} if(name.equals("Worker") && tile.improvementInProgress!=null) workOnImprovement(tile); - if ("automation".equals(action)) doAutomatedAction(tile); } @@ -88,9 +89,13 @@ public class MapUnit{ public void doAutomatedAction(TileInfo tile){ TileInfo toWork = findTileToWork(tile); if(toWork==null) return; // Don't know what to do. Sorry. - if(toWork!=tile) tile = headTowards(tile.position,toWork.position); - if(toWork == tile && tile.improvementInProgress==null) tile.startWorkingOnImprovement(chooseImprovement(tile)); - doAction(tile); + if(toWork!=tile) { + tile = headTowards(tile.position, toWork.position); + doAction(tile); + return; + } + if(tile.improvementInProgress == null) tile.startWorkingOnImprovement(chooseImprovement(tile)); + workOnImprovement(tile); } private String chooseImprovement(final TileInfo tile){ diff --git a/core/src/com/unciv/ui/CityScreen.java b/core/src/com/unciv/ui/CityScreen.java index e244e9fa89..36d96905eb 100644 --- a/core/src/com/unciv/ui/CityScreen.java +++ b/core/src/com/unciv/ui/CityScreen.java @@ -148,57 +148,64 @@ public class CityScreen extends CameraStageBaseScreen { else Others.add(building); } - Label label = new Label("Wonders",skin); - label.setFontScale(1.5f); - label.setColor(Color.GREEN); - BuildingsTable.add(label).pad(5).row(); - for(Building building:Wonders) BuildingsTable.add(new Label(building.name,skin)).pad(5).row(); - - label = new Label("Specialist Buildings",skin); - label.setFontScale(1.5f); - label.setColor(Color.GREEN); - BuildingsTable.add(label).pad(5).row(); - for(Building building:SpecialistBuildings) { - BuildingsTable.add(new Label(building.name, skin)).pad(5); - Table specialists = new Table(); - specialists.row().size(20).pad(5); - if (!getCity().population.buildingsSpecialists.containsKey(building.name)) - getCity().population.buildingsSpecialists.put(building.name, new FullStats()); - FullStats currentBuildingSpecialists = getCity().population.buildingsSpecialists.get(building.name); - for (int i = 0; i < building.specialistSlots.production; i++) { - specialists.add(getSpecialistIcon("StatIcons/populationBrown.png", building.name, - currentBuildingSpecialists.production > i, new FullStats() {{ - production = 1; - }})); - } - for (int i = 0; i < building.specialistSlots.science; i++) { - specialists.add(getSpecialistIcon("StatIcons/populationBlue.png", building.name, - currentBuildingSpecialists.science > i, new FullStats() {{ - science = 1; - }})); - } - for (int i = 0; i < building.specialistSlots.culture; i++) { - specialists.add(getSpecialistIcon("StatIcons/populationPurple.png", building.name, - currentBuildingSpecialists.culture > i, new FullStats() {{ - culture = 1; - }})); - } - for (int i = 0; i < building.specialistSlots.gold; i++) { - specialists.add(getSpecialistIcon("StatIcons/populationYellow.png", building.name, - currentBuildingSpecialists.gold > i, new FullStats() {{ - gold = 1; - }})); - } - BuildingsTable.add(specialists).row(); + if(!Wonders.isEmpty()) { + Label label = new Label("Wonders", skin); + label.setFontScale(1.5f); + label.setColor(Color.GREEN); + BuildingsTable.add(label).pad(5).row(); + for (Building building : Wonders) + BuildingsTable.add(new Label(building.name, skin)).pad(5).row(); } - label = new Label("Buildings",skin); + if(!SpecialistBuildings.isEmpty()) { + Label label = new Label("Specialist Buildings", skin); + label.setFontScale(1.5f); + label.setColor(Color.GREEN); + BuildingsTable.add(label).pad(5).row(); + for (Building building : SpecialistBuildings) { + BuildingsTable.add(new Label(building.name, skin)).pad(5); + Table specialists = new Table(); + specialists.row().size(20).pad(5); + if (!getCity().population.buildingsSpecialists.containsKey(building.name)) + getCity().population.buildingsSpecialists.put(building.name, new FullStats()); + FullStats currentBuildingSpecialists = getCity().population.buildingsSpecialists.get(building.name); + for (int i = 0; i < building.specialistSlots.production; i++) { + specialists.add(getSpecialistIcon("StatIcons/populationBrown.png", building.name, + currentBuildingSpecialists.production > i, new FullStats() {{ + production = 1; + }})); + } + for (int i = 0; i < building.specialistSlots.science; i++) { + specialists.add(getSpecialistIcon("StatIcons/populationBlue.png", building.name, + currentBuildingSpecialists.science > i, new FullStats() {{ + science = 1; + }})); + } + for (int i = 0; i < building.specialistSlots.culture; i++) { + specialists.add(getSpecialistIcon("StatIcons/populationPurple.png", building.name, + currentBuildingSpecialists.culture > i, new FullStats() {{ + culture = 1; + }})); + } + for (int i = 0; i < building.specialistSlots.gold; i++) { + specialists.add(getSpecialistIcon("StatIcons/populationYellow.png", building.name, + currentBuildingSpecialists.gold > i, new FullStats() {{ + gold = 1; + }})); + } + BuildingsTable.add(specialists).row(); + } + } - label.setFontScale(1.5f); - label.setColor(Color.GREEN); - BuildingsTable.add(label).pad(5).row(); - for(Building building:Others) BuildingsTable.add(new Label(building.name,skin)).pad(5).row(); + if(!Others.isEmpty()) { + Label label = new Label("Buildings", skin); + label.setFontScale(1.5f); + label.setColor(Color.GREEN); + BuildingsTable.add(label).pad(5).row(); + for (Building building : Others) + BuildingsTable.add(new Label(building.name, skin)).pad(5).row(); + } BuildingsTable.pack(); } diff --git a/core/src/com/unciv/ui/WorldScreen.java b/core/src/com/unciv/ui/WorldScreen.java index ccd661cc78..2a99b7bc54 100644 --- a/core/src/com/unciv/ui/WorldScreen.java +++ b/core/src/com/unciv/ui/WorldScreen.java @@ -16,6 +16,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Predicate; import com.unciv.logic.civilization.CivilizationInfo; +import com.unciv.logic.civilization.Notification; import com.unciv.logic.map.TileInfo; import com.unciv.ui.pickerscreens.PolicyPickerScreen; import com.unciv.ui.pickerscreens.TechPickerScreen; @@ -49,6 +50,7 @@ public class WorldScreen extends CameraStageBaseScreen { Table optionsTable = new Table(); Table notificationsTable = new Table(); + ScrollPane notificationsScroll = new ScrollPane(notificationsTable); TextButton selectIdleUnitButton; public WorldScreen() { @@ -57,7 +59,7 @@ public class WorldScreen extends CameraStageBaseScreen { addTiles(); stage.addActor(tileTable); - Drawable tileTableBackground = com.unciv.ui.utils.ImageGetter.getDrawable("skin/tileTableBackground.png") + Drawable tileTableBackground = ImageGetter.getDrawable("skin/tileTableBackground.png") .tint(new Color(0x004085bf)); tileTableBackground.setMinHeight(0); tileTableBackground.setMinWidth(0); @@ -66,14 +68,12 @@ public class WorldScreen extends CameraStageBaseScreen { //notificationsTable.background(ImageGetter.getSingleColorDrawable(new Color(0x004085bf))); - TextureRegionDrawable civBackground = com.unciv.ui.utils.ImageGetter.getDrawable("skin/civTableBackground.png"); + TextureRegionDrawable civBackground = ImageGetter.getDrawable("skin/civTableBackground.png"); civTable.setBackground(civBackground.tint(new Color(0x004085bf))); stage.addActor(civTable); stage.addActor(techButton); - ScrollPane notificationsScroll = new ScrollPane(notificationsTable); - notificationsScroll.setSize(stage.getWidth() / 3, stage.getHeight() / 3); stage.addActor(notificationsScroll); addSelectIdleUnitButton(); update(); @@ -145,13 +145,13 @@ public class WorldScreen extends CameraStageBaseScreen { private void updateNotificationsList() { notificationsTable.clearChildren(); - for (final CivilizationInfo.Notification notification : game.civInfo.notifications) { + for (final Notification notification : game.civInfo.notifications) { Label label = new Label(notification.text, skin); label.setColor(Color.WHITE); label.setFontScale(1.2f); Table minitable = new Table(); - minitable.background(com.unciv.ui.utils.ImageGetter.getDrawable("skin/civTableBackground.png") + minitable.background(ImageGetter.getDrawable("skin/civTableBackground.png") .tint(new Color(0x004085bf))); minitable.add(label).pad(5); @@ -168,6 +168,9 @@ public class WorldScreen extends CameraStageBaseScreen { notificationsTable.row(); } notificationsTable.pack(); + + notificationsScroll.setSize(stage.getWidth() / 3, + Math.min(notificationsTable.getHeight(),stage.getHeight() / 3)); } public void update() {