writing correct comp id for chosen compressor

This commit is contained in:
minjaesong
2023-12-21 03:53:56 +09:00
parent 6f4e60284b
commit b496e3de3a
3 changed files with 7 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ object WriteWorld {
val world = ingame.world
val currentPlayTime_t = time_t - ingame.loadedTime_t
world.comp = Common.COMP_ZSTD
world.comp = Common.getCompIndex()
world.lastPlayTime = time_t
world.totalPlayTime += currentPlayTime_t

View File

@@ -44,6 +44,7 @@ object Common {
const val COMP_GZIP = 1
// const val COMP_LZMA = 2
const val COMP_ZSTD = 3
const val COMP_SNAPPY = 4
val CHARSET = Charsets.UTF_8
@@ -529,6 +530,10 @@ object Common {
}
}
fun getCompIndex() = when (App.getConfigString("savegamecomp")) {
"snappy" -> COMP_SNAPPY
else -> COMP_ZSTD
}
fun enasciiToString(ba: ByteArray64): String = enasciiToString(ba.iterator())
fun enasciiToString(ba: Iterator<Byte>): String {

View File

@@ -45,7 +45,7 @@ object WriteSimpleWorld {
private fun preWrite(ingame: IngameInstance, time_t: Long, world: SimpleGameWorld, actorsList: List<Actor>) {
val currentPlayTime_t = time_t - ingame.loadedTime_t
world.comp = Common.COMP_ZSTD
world.comp = Common.getCompIndex()
world.lastPlayTime = time_t
world.totalPlayTime += currentPlayTime_t