mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 10:54:19 -04:00
chore: Hexmath purity
This commit is contained in:
parent
e3a2e41b19
commit
0abcd22728
@ -49,6 +49,9 @@ allprojects {
|
|||||||
configure<yairm210.purity.PurityConfiguration>{
|
configure<yairm210.purity.PurityConfiguration>{
|
||||||
wellKnownPureFunctions = setOf(
|
wellKnownPureFunctions = setOf(
|
||||||
"com.unciv.logic.civilization.diplomacy.RelationshipLevel.compareTo",
|
"com.unciv.logic.civilization.diplomacy.RelationshipLevel.compareTo",
|
||||||
|
"kotlin.math.max",
|
||||||
|
"kotlin.math.min",
|
||||||
|
"kotlin.math.abs"
|
||||||
)
|
)
|
||||||
wellKnownReadonlyFunctions = setOf(
|
wellKnownReadonlyFunctions = setOf(
|
||||||
// Looks like the Collection.contains is not considered overridden :thunk:
|
// Looks like the Collection.contains is not considered overridden :thunk:
|
||||||
|
@ -232,10 +232,12 @@ object HexMath {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Get number of hexes from [origin] to [destination] _without respecting world-wrap_ */
|
/** Get number of hexes from [origin] to [destination] _without respecting world-wrap_ */
|
||||||
|
@Pure
|
||||||
fun getDistance(origin: Vector2, destination: Vector2): Int {
|
fun getDistance(origin: Vector2, destination: Vector2): Int {
|
||||||
return getDistance(origin.x.toInt(), origin.y.toInt(), destination.x.toInt(), destination.y.toInt())
|
return getDistance(origin.x.toInt(), origin.y.toInt(), destination.x.toInt(), destination.y.toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Pure
|
||||||
fun getDistance(originX: Int, originY: Int, destinationX: Int, destinationY: Int): Int {
|
fun getDistance(originX: Int, originY: Int, destinationX: Int, destinationY: Int): Int {
|
||||||
val relativeX = originX - destinationX
|
val relativeX = originX - destinationX
|
||||||
val relativeY = originY - destinationY
|
val relativeY = originY - destinationY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user