mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
disallowing nicknames (may contain non-ascii) on filename: somehow incompatible with BTRFS and Java 17?
This commit is contained in:
@@ -788,7 +788,7 @@ fun AppUpdateListOfSavegames() {
|
|||||||
// create list of worlds
|
// create list of worlds
|
||||||
File(worldsDir).listFiles().filter { !it.isDirectory && !it.name.contains('.') }.mapNotNull { file ->
|
File(worldsDir).listFiles().filter { !it.isDirectory && !it.name.contains('.') }.mapNotNull { file ->
|
||||||
try {
|
try {
|
||||||
DiskSkimmer(file, Common.CHARSET, true)
|
DiskSkimmer(file, true)
|
||||||
}
|
}
|
||||||
catch (e: Throwable) {
|
catch (e: Throwable) {
|
||||||
System.err.println("Unable to load a world file ${file.absolutePath}")
|
System.err.println("Unable to load a world file ${file.absolutePath}")
|
||||||
@@ -814,7 +814,7 @@ fun AppUpdateListOfSavegames() {
|
|||||||
// create list of players
|
// create list of players
|
||||||
File(playersDir).listFiles().filter { !it.isDirectory && !it.name.contains('.') }.mapNotNull { file ->
|
File(playersDir).listFiles().filter { !it.isDirectory && !it.name.contains('.') }.mapNotNull { file ->
|
||||||
try {
|
try {
|
||||||
DiskSkimmer(file, Common.CHARSET, true)
|
DiskSkimmer(file, true)
|
||||||
}
|
}
|
||||||
catch (e: Throwable) {
|
catch (e: Throwable) {
|
||||||
System.err.println("Unable to load a player file ${file.absolutePath}")
|
System.err.println("Unable to load a player file ${file.absolutePath}")
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
|
|
||||||
private fun postInitForNewGame() {
|
private fun postInitForNewGame() {
|
||||||
worldSavefileName = LoadSavegame.getWorldSavefileName(savegameNickname, world)
|
worldSavefileName = LoadSavegame.getWorldSavefileName(world)
|
||||||
playerSavefileName = LoadSavegame.getPlayerSavefileName(actorGamer)
|
playerSavefileName = LoadSavegame.getPlayerSavefileName(actorGamer)
|
||||||
|
|
||||||
worldDisk = VDUtil.createNewDisk(
|
worldDisk = VDUtil.createNewDisk(
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class QuickSingleplayerWorldSavingThread(
|
|||||||
|
|
||||||
|
|
||||||
override fun save() {
|
override fun save() {
|
||||||
val skimmer = DiskSkimmer(outFile, Common.CHARSET)
|
val skimmer = DiskSkimmer(outFile)
|
||||||
|
|
||||||
if (hasThumbnail) {
|
if (hasThumbnail) {
|
||||||
while (!IngameRenderer.fboRGBexportedLatch) {
|
while (!IngameRenderer.fboRGBexportedLatch) {
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ object WriteSavegame {
|
|||||||
object LoadSavegame {
|
object LoadSavegame {
|
||||||
|
|
||||||
fun getSavegameNickname(worldDisk: SimpleFileSystem) = worldDisk.getDiskName(Common.CHARSET)
|
fun getSavegameNickname(worldDisk: SimpleFileSystem) = worldDisk.getDiskName(Common.CHARSET)
|
||||||
fun getWorldSavefileName(nick: String, world: GameWorld) = "$nick-${world.worldIndex}"
|
fun getWorldSavefileName(world: GameWorld) = "${world.worldIndex}"
|
||||||
fun getPlayerSavefileName(player: IngamePlayer) = (player.actorValue.getAsString(AVKey.NAME) ?: "Player") + "-${player.uuid}"
|
fun getPlayerSavefileName(player: IngamePlayer) = "${player.uuid}"
|
||||||
|
|
||||||
fun getFileBytes(disk: SimpleFileSystem, id: Long): ByteArray64 = disk.getFile(id)!!.bytes
|
fun getFileBytes(disk: SimpleFileSystem, id: Long): ByteArray64 = disk.getFile(id)!!.bytes
|
||||||
fun getFileReader(disk: SimpleFileSystem, id: Long): Reader = ByteArray64Reader(getFileBytes(disk, id), Common.CHARSET)
|
fun getFileReader(disk: SimpleFileSystem, id: Long): Reader = ByteArray64Reader(getFileBytes(disk, id), Common.CHARSET)
|
||||||
@@ -136,7 +136,7 @@ object LoadSavegame {
|
|||||||
newIngame.worldDisk = VDUtil.readDiskArchive(worldDisk.diskFile, Level.INFO)
|
newIngame.worldDisk = VDUtil.readDiskArchive(worldDisk.diskFile, Level.INFO)
|
||||||
newIngame.playerDisk = VDUtil.readDiskArchive(playerDisk.diskFile, Level.INFO)
|
newIngame.playerDisk = VDUtil.readDiskArchive(playerDisk.diskFile, Level.INFO)
|
||||||
newIngame.savegameNickname = getSavegameNickname(worldDisk)
|
newIngame.savegameNickname = getSavegameNickname(worldDisk)
|
||||||
newIngame.worldSavefileName = getWorldSavefileName(newIngame.savegameNickname, world)
|
newIngame.worldSavefileName = getWorldSavefileName(world)
|
||||||
newIngame.playerSavefileName = getPlayerSavefileName(player)
|
newIngame.playerSavefileName = getPlayerSavefileName(player)
|
||||||
|
|
||||||
// worldDisk.dispose()
|
// worldDisk.dispose()
|
||||||
|
|||||||
@@ -239,14 +239,14 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
|
|||||||
it.seed = seed shake selectionMagic
|
it.seed = seed shake selectionMagic
|
||||||
}
|
}
|
||||||
|
|
||||||
val terrainAutocorrect = ModuleAutoCorrect().also { // absolutely required
|
val terrainScaleOffset = ModuleScaleOffset().also {
|
||||||
it.setSource(terrainTypeFractal)
|
it.setSource(terrainTypeFractal)
|
||||||
it.setLow(0.0)
|
it.setOffset(0.5)
|
||||||
it.setHigh(1.0)
|
it.setScale(0.5)
|
||||||
} // TODO REPLACE WITH ScaleOffset and play with the both values
|
}
|
||||||
|
|
||||||
val terrainTypeYScale = ModuleScaleDomain().also {
|
val terrainTypeYScale = ModuleScaleDomain().also {
|
||||||
it.setSource(terrainAutocorrect)
|
it.setSource(terrainScaleOffset)
|
||||||
it.setScaleY(0.0)
|
it.setScaleY(0.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import kotlin.experimental.and
|
|||||||
*/
|
*/
|
||||||
class DiskSkimmer(
|
class DiskSkimmer(
|
||||||
val diskFile: File,
|
val diskFile: File,
|
||||||
val charset: Charset = Charset.defaultCharset(),
|
|
||||||
noInit: Boolean = false
|
noInit: Boolean = false
|
||||||
): SimpleFileSystem {
|
): SimpleFileSystem {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user