From f740e9663fc61df8c35651300305d8e0195356f2 Mon Sep 17 00:00:00 2001 From: Assasinnys Date: Tue, 19 May 2020 02:32:38 +0300 Subject: [PATCH] fix: fun equals for StarPoint --- src/main/kotlin/elite/algorithm/StarPoint.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/elite/algorithm/StarPoint.kt b/src/main/kotlin/elite/algorithm/StarPoint.kt index d197864..6f01fb7 100644 --- a/src/main/kotlin/elite/algorithm/StarPoint.kt +++ b/src/main/kotlin/elite/algorithm/StarPoint.kt @@ -41,8 +41,17 @@ class StarPoint( } } - override fun equals(other: Any?) = - if (other != null && other is StarPoint) this.systemId64 == other.systemId64 else false + override fun equals(other: Any?): Boolean { + return if (other != null && other is StarPoint) { + if (this.systemId64 == other.systemId64) { + true + } else { + super.equals(other) + } + } else { + super.equals(other) + } + } private fun calculateCostH(finishCoords: Coordinates) = calcDistance(coords.x, finishCoords.x, coords.y, finishCoords.y, coords.z, finishCoords.z).toInt()