mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-16 02:40:41 +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())
|
||||
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() {
|
||||
|
@ -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<String, String>()
|
||||
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 {
|
||||
if (characterSetCache.containsKey(language)) return characterSetCache[language]!!
|
||||
|
Reference in New Issue
Block a user