From 279269d4a3b28cac622d340ddadba5b5560c02b4 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 25 Nov 2017 22:48:34 +0200 Subject: [PATCH] Fixed bug where getRandom would never return the last value from the list --- core/src/com/unciv/game/TileGroup.java | 2 +- core/src/com/unciv/models/LinqCollection.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/game/TileGroup.java b/core/src/com/unciv/game/TileGroup.java index 2c61f631..5182f3bc 100644 --- a/core/src/com/unciv/game/TileGroup.java +++ b/core/src/com/unciv/game/TileGroup.java @@ -22,7 +22,7 @@ public class TileGroup extends Group { TileGroup(TileInfo tileInfo){ this.tileInfo = tileInfo; - String terrainFileName = "TerrainIcons/" + tileInfo.GetLastTerrain().Name + "_(Civ5).png"; + String terrainFileName = "TerrainIcons/" + tileInfo.GetLastTerrain().Name.replace(' ','_') + "_(Civ5).png"; terrainImage = ImageGetter.getImageByFilename(terrainFileName); terrainImage.setSize(50,50); addActor(terrainImage); diff --git a/core/src/com/unciv/models/LinqCollection.java b/core/src/com/unciv/models/LinqCollection.java index eb46bfe5..f5ebf057 100644 --- a/core/src/com/unciv/models/LinqCollection.java +++ b/core/src/com/unciv/models/LinqCollection.java @@ -43,7 +43,7 @@ public class LinqCollection extends ArrayList { public T getRandom(){ if(size()==0) return null; - return get((int) (Math.random() * (size() - 1))); + return get((int) (Math.random() * (size()))); } public interface Func {