gson test in progress

This commit is contained in:
minjaesong
2019-02-22 04:26:19 +09:00
parent d23c3ed389
commit 0fee72c5d3
46 changed files with 379 additions and 3061 deletions

View File

@@ -35,7 +35,7 @@ abstract class Actor(val renderOrder: RenderOrder) : Comparable<Actor>, Runnable
* @return Reference ID. (16777216-0x7FFF_FFFF)
*/
open var referenceID: ActorID? = null
var actorValue = ActorValue(this)
var actorValue = ActorValue(this) // FIXME cyclic reference on GSON
@Volatile var flagDespawn = false
override fun equals(other: Any?): Boolean {

View File

@@ -5,7 +5,7 @@ import net.torvald.terrarum.KVHashMap
/**
* Created by minjaesong on 2017-04-28.
*/
class ActorValue(val actor: Actor) : KVHashMap() {
class ActorValue(@Transient val actor: Actor) : KVHashMap() {
private constructor(actor: Actor, newMap: HashMap<String, Any>): this(actor) {
hashMap = newMap

View File

@@ -32,7 +32,7 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean =
ActorWithBody(renderOrder) {
val COLLISION_TEST_MODE = false
@Transient val COLLISION_TEST_MODE = false
/* !! ActorValue macros are on the very bottom of the source !! */
@@ -1155,15 +1155,15 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean =
}
}*/
private inline val submergedRatio: Double
private val submergedRatio: Double
get() {
if (hitbox.height == 0.0) throw RuntimeException("Hitbox.height is zero")
return submergedHeight / hitbox.height
}
private inline val submergedVolume: Double
private val submergedVolume: Double
get() = submergedHeight * hitbox.width * hitbox.width
private inline val submergedHeight: Double
private val submergedHeight: Double
get() = Math.max(
getContactingAreaFluid(COLLIDING_LEFT),
getContactingAreaFluid(COLLIDING_RIGHT)