diff --git a/core/src/com/unciv/logic/city/CityExpansionManager.kt b/core/src/com/unciv/logic/city/CityExpansionManager.kt index 3b4610fd69..ed9816ebc1 100644 --- a/core/src/com/unciv/logic/city/CityExpansionManager.kt +++ b/core/src/com/unciv/logic/city/CityExpansionManager.kt @@ -75,14 +75,15 @@ class CityExpansionManager { for(tile in cityInfo.getTiles()) relinquishOwnership(tile) - cityInfo.getCenterTile().getTilesInDistance(1) - .filter { it.getCity()==null } // can't take ownership of owned tiles (by other cities) - .forEach { takeOwnership(it) } - // The only way to create a city inside an owned tile is if it's in your territory // In this case, if you don't assign control of the central tile to the city, // It becomes an invisible city and weird shit starts happening takeOwnership(cityInfo.getCenterTile()) + + cityInfo.getCenterTile().getTilesInDistance(1) + .filter { it.getCity()==null } // can't take ownership of owned tiles (by other cities) + .forEach { takeOwnership(it) } + } private fun addNewTileWithCulture() { diff --git a/core/src/com/unciv/ui/utils/Fonts.kt b/core/src/com/unciv/ui/utils/Fonts.kt index ae4dea87f7..4c72f0812d 100644 --- a/core/src/com/unciv/ui/utils/Fonts.kt +++ b/core/src/com/unciv/ui/utils/Fonts.kt @@ -6,48 +6,13 @@ import com.unciv.UnCivGame import com.unciv.models.gamebasics.GameBasics import core.java.nativefont.NativeFont import core.java.nativefont.NativeFontPaint -import java.io.FileInputStream -import java.io.FileOutputStream -import java.net.URL -import java.security.MessageDigest class Fonts { + // caches for memory and time saving companion object { val characterSetCache = HashMap() val fontCache = HashMap() } - fun download(link: String,fontForLanguage: String) { - if (!Gdx.files.local("fonts").exists()) - Gdx.files.local("fonts").mkdirs() - val input = URL(link).openStream() - val output = FileOutputStream(Gdx.files.local("fonts/$fontForLanguage.ttf").file()) - input.use { - output.use { - input.copyTo(output) - } - } - } - fun getMD5(fontForLanguage: String):String { - val sb = StringBuffer("") - val md = MessageDigest.getInstance("MD5") - if (Gdx.files.local("fonts/$fontForLanguage.ttf").exists()) { - md.update(FileInputStream(Gdx.files.local("fonts/$fontForLanguage.ttf").file()).readBytes()) - val b = md.digest() - for (i in b) { - var d = i.toInt() - if (d < 0) d = i + 256 - if (d < 16) sb.append("0") - sb.append(Integer.toHexString(d)) - } - return sb.toString() - } - return "" - } - fun containsFont(): Boolean { - if (Gdx.files.local("fonts/WenQuanYiMicroHei.ttf").exists()) - return true - return false - } fun getCharactersForFont(language:String=""): String { if (characterSetCache.containsKey(language)) return characterSetCache[language]!!