mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 21:11:35 +07:00
performance: Don't calc checksum for non-multiplayer games, no one cares if you hack your own game
This commit is contained in:
parent
a2fa4cebf4
commit
5cc57f9293
@ -37,7 +37,6 @@ import java.io.PrintWriter
|
|||||||
import java.io.StringWriter
|
import java.io.StringWriter
|
||||||
import java.io.Writer
|
import java.io.Writer
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.util.Arrays
|
|
||||||
import java.util.GregorianCalendar
|
import java.util.GregorianCalendar
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
@ -69,13 +68,12 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
|
|||||||
private const val FILE_STORAGE = "FILE_STORAGE"
|
private const val FILE_STORAGE = "FILE_STORAGE"
|
||||||
private const val AUTH_HEADER = "AUTH_HEADER"
|
private const val AUTH_HEADER = "AUTH_HEADER"
|
||||||
|
|
||||||
|
private val constraints = Constraints.Builder()
|
||||||
|
// If no internet is available, worker waits before becoming active.
|
||||||
|
.setRequiredNetworkType(NetworkType.CONNECTED)
|
||||||
|
.build()
|
||||||
|
|
||||||
fun enqueue(appContext: Context, delay: Duration, inputData: Data) {
|
fun enqueue(appContext: Context, delay: Duration, inputData: Data) {
|
||||||
|
|
||||||
val constraints = Constraints.Builder()
|
|
||||||
// If no internet is available, worker waits before becoming active.
|
|
||||||
.setRequiredNetworkType(NetworkType.CONNECTED)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
val checkTurnWork = OneTimeWorkRequestBuilder<MultiplayerTurnCheckWorker>()
|
val checkTurnWork = OneTimeWorkRequestBuilder<MultiplayerTurnCheckWorker>()
|
||||||
.setConstraints(constraints)
|
.setConstraints(constraints)
|
||||||
.setInitialDelay(delay.seconds, TimeUnit.SECONDS)
|
.setInitialDelay(delay.seconds, TimeUnit.SECONDS)
|
||||||
|
@ -372,7 +372,7 @@ class UncivFiles(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Returns gzipped serialization of [game], optionally gzipped ([forceZip] overrides [saveZipped]) */
|
/** Returns gzipped serialization of [game], optionally gzipped ([forceZip] overrides [saveZipped]) */
|
||||||
fun gameInfoToString(game: GameInfo, forceZip: Boolean? = null, updateChecksum:Boolean=true): String {
|
fun gameInfoToString(game: GameInfo, forceZip: Boolean? = null, updateChecksum:Boolean=false): String {
|
||||||
game.version = GameInfo.CURRENT_COMPATIBILITY_VERSION
|
game.version = GameInfo.CURRENT_COMPATIBILITY_VERSION
|
||||||
|
|
||||||
if (updateChecksum) game.checksum = game.calculateChecksum()
|
if (updateChecksum) game.checksum = game.calculateChecksum()
|
||||||
|
Loading…
Reference in New Issue
Block a user