mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-22 13:49:54 +07:00
Removed unused Fonts functions
Fixed bug on city creation caused by 750ca0c
This commit is contained in:
@ -75,14 +75,15 @@ class CityExpansionManager {
|
|||||||
for(tile in cityInfo.getTiles())
|
for(tile in cityInfo.getTiles())
|
||||||
relinquishOwnership(tile)
|
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
|
// 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,
|
// 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
|
// It becomes an invisible city and weird shit starts happening
|
||||||
takeOwnership(cityInfo.getCenterTile())
|
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() {
|
private fun addNewTileWithCulture() {
|
||||||
|
@ -6,48 +6,13 @@ import com.unciv.UnCivGame
|
|||||||
import com.unciv.models.gamebasics.GameBasics
|
import com.unciv.models.gamebasics.GameBasics
|
||||||
import core.java.nativefont.NativeFont
|
import core.java.nativefont.NativeFont
|
||||||
import core.java.nativefont.NativeFontPaint
|
import core.java.nativefont.NativeFontPaint
|
||||||
import java.io.FileInputStream
|
|
||||||
import java.io.FileOutputStream
|
|
||||||
import java.net.URL
|
|
||||||
import java.security.MessageDigest
|
|
||||||
|
|
||||||
class Fonts {
|
class Fonts {
|
||||||
|
// caches for memory and time saving
|
||||||
companion object {
|
companion object {
|
||||||
val characterSetCache = HashMap<String, String>()
|
val characterSetCache = HashMap<String, String>()
|
||||||
val fontCache = HashMap<String, BitmapFont>()
|
val fontCache = HashMap<String, BitmapFont>()
|
||||||
}
|
}
|
||||||
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 {
|
fun getCharactersForFont(language:String=""): String {
|
||||||
if (characterSetCache.containsKey(language)) return characterSetCache[language]!!
|
if (characterSetCache.containsKey(language)) return characterSetCache[language]!!
|
||||||
|
Reference in New Issue
Block a user