diff --git a/android/build.gradle b/android/build.gradle index 026832e8ae..99619a721e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,7 +21,7 @@ android { applicationId "com.unciv.game" minSdkVersion 9 targetSdkVersion 25 - versionCode 15 + versionCode 16 versionName "0.9" } buildTypes { diff --git a/core/src/com/unciv/civinfo/MapUnit.java b/core/src/com/unciv/civinfo/MapUnit.java index b698a8c65f..9c99d520cc 100644 --- a/core/src/com/unciv/civinfo/MapUnit.java +++ b/core/src/com/unciv/civinfo/MapUnit.java @@ -37,23 +37,6 @@ public class MapUnit{ else if(tile.improvementInProgress.equals("Road")) tile.roadStatus = RoadStatus.Road; else if(tile.improvementInProgress.equals("Railroad")) tile.roadStatus = RoadStatus.Railroad; else tile.improvement = tile.improvementInProgress; - - String notification = tile.improvementInProgress+" has been completed"; - if(tile.workingCity!=null) notification+=" for "+tile.getCity().name; - else { - for (int i = 1; i < 3; i++) { - LinqCollection tilesWithCity = CivilizationInfo.current().tileMap.getTilesInDistance(tile.position, i).where(new Predicate() { - @Override - public boolean evaluate(TileInfo arg0) { - return arg0.isCityCenter(); - } - }); - if(tilesWithCity.isEmpty()) continue; - notification+=" near "+tilesWithCity.get(0).workingCity; - break; - } - } - CivilizationInfo.current().notifications.add(notification+"!"); tile.improvementInProgress = null; } } diff --git a/core/src/com/unciv/game/TileGroup.java b/core/src/com/unciv/game/TileGroup.java index 6352479e1d..b4918e5dd7 100644 --- a/core/src/com/unciv/game/TileGroup.java +++ b/core/src/com/unciv/game/TileGroup.java @@ -107,28 +107,29 @@ public class TileGroup extends Group { } if(tileInfo.roadStatus != RoadStatus.None){ - for (TileInfo neighbor : CivilizationInfo.current().tileMap.getTilesInDistance(tileInfo.position,1)) { - if (neighbor == tileInfo || neighbor.roadStatus == RoadStatus.None) continue; - if (roadImages.containsKey(neighbor.position.toString())) continue; + for (TileInfo neighbor : CivilizationInfo.current().tileMap.getTilesAtDistance(tileInfo.position,1)) { + if (neighbor.roadStatus == RoadStatus.None) continue; + if (!roadImages.containsKey(neighbor.position.toString())) { + Image image = ImageGetter.getImage(ImageGetter.WhiteDot); + roadImages.put(neighbor.position.toString(), image); + + Vector2 relativeHexPosition = tileInfo.position.cpy().sub(neighbor.position); + Vector2 relativeWorldPosition = HexMath.Hex2WorldCoords(relativeHexPosition); + + // This is some crazy voodoo magic so I'll explain. + image.moveBy(25, 25); // Move road to center of tile + // in addTiles, we set the position of groups by relative world position *0.8*groupSize, where groupSize = 50 + // Here, we want to have the roads start HALFWAY THERE and extend towards the tiles, so we give them a position of 0.8*25. + image.moveBy(-relativeWorldPosition.x * 0.8f * 25, -relativeWorldPosition.y * 0.8f * 25); + image.setSize(10, 2); + addActor(image); + image.setOrigin(0, 1); // This is so that the rotation is calculated from the middle of the road and not the edge + image.setRotation((float) (180 / Math.PI * Math.atan2(relativeWorldPosition.y, relativeWorldPosition.x))); + } - Image image = ImageGetter.getImage(ImageGetter.WhiteDot); if(tileInfo.roadStatus == RoadStatus.Railroad && neighbor.roadStatus == RoadStatus.Railroad) - image.setColor(Color.BLACK); // railroad - else image.setColor(Color.BROWN); // road - roadImages.put(neighbor.position.toString(), image); - - Vector2 relativeHexPosition = tileInfo.position.cpy().sub(neighbor.position); - Vector2 relativeWorldPosition = HexMath.Hex2WorldCoords(relativeHexPosition); - - // This is some crazy voodoo magic so I'll explain. - image.moveBy(25, 25); // Move road to center of tile - // in addTiles, we set the position of groups by relative world position *0.8*groupSize, where groupSize = 50 - // Here, we want to have the roads start HALFWAY THERE and extend towards the tiles, so we give them a position of 0.8*25. - image.moveBy(-relativeWorldPosition.x * 0.8f * 25, -relativeWorldPosition.y * 0.8f * 25); - image.setSize(10, 2); - addActor(image); - image.setOrigin(0, 1); // This is so that the rotation is calculated from the middle of the road and not the edge - image.setRotation((float) (180 / Math.PI * Math.atan2(relativeWorldPosition.y, relativeWorldPosition.x))); + roadImages.get(neighbor.position.toString()).setColor(Color.GRAY); // railroad + else roadImages.get(neighbor.position.toString()).setColor(Color.BROWN); // road } } } diff --git a/core/src/com/unciv/game/WorldScreen.java b/core/src/com/unciv/game/WorldScreen.java index c333e09889..96d88dd4ef 100644 --- a/core/src/com/unciv/game/WorldScreen.java +++ b/core/src/com/unciv/game/WorldScreen.java @@ -132,6 +132,7 @@ public class WorldScreen extends CameraStageBaseScreen { for (String notification : game.civInfo.notifications) { Label label = new Label(notification, skin); label.setColor(Color.WHITE); + label.setFontScale(0.9f); notificationsTable.add(label).pad(10).fill(); notificationsTable.row(); } @@ -346,12 +347,12 @@ public class WorldScreen extends CameraStageBaseScreen { } for (TileGroup group : tileGroups.linqValues()) { - group.moveBy(-bottomX, -bottomY); + group.moveBy(-bottomX+50, -bottomY+50); } // allTiles.setPosition(-bottomX,-bottomY); // there are tiles "below the zero", // so we zero out the starting position of the whole board so they will be displayed as well - allTiles.setSize(topX - bottomX, topY - bottomY); + allTiles.setSize(100 + topX - bottomX, 100 + topY - bottomY); scrollPane = new ScrollPane(allTiles);