mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-16 05:24:06 +09:00
serialised RNG; font update
This commit is contained in:
@@ -1,29 +1,14 @@
|
||||
package net.torvald.terrarum.modulebasegame
|
||||
|
||||
import net.torvald.random.HQRNG
|
||||
import java.util.*
|
||||
|
||||
internal interface RNGConsumer {
|
||||
|
||||
val RNG: Random
|
||||
var seed: Long
|
||||
var iterations: Int
|
||||
val RNG: HQRNG
|
||||
|
||||
fun loadFromSave(seed: Long, iterations: Int) {
|
||||
this.seed = seed
|
||||
this.iterations = iterations
|
||||
|
||||
repeat(iterations, { RNG.nextInt() })
|
||||
}
|
||||
|
||||
private fun incIterations() {
|
||||
iterations++
|
||||
|
||||
if (iterations < 0) iterations = 0
|
||||
}
|
||||
|
||||
fun getRandomLong(): Long {
|
||||
iterations++
|
||||
return RNG.nextLong()
|
||||
fun loadFromSave(s0: Long, s1: Long) {
|
||||
RNG.reseed(s0, s1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user