DEADSOFTWARE

Delete old GameItems
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / model / item / Item.kt
index 42dae7ea68eee2c0b47098c3805ae68416d28dae..a479a4f7280c2ad8d5fd936dd78546a01f13bf74 100644 (file)
@@ -11,6 +11,14 @@ sealed class Item {
     abstract val params: CommonItemParams
     abstract val sprite: Sprite
 
+    override fun hashCode(): Int {
+        return params.key.hashCode()
+    }
+
+    override fun equals(other: Any?): Boolean {
+        return params.key == (other as Item).params.key
+    }
+
     fun isPlaceable(): Boolean {
         contract { returns(true) implies (this@Item is Placeable) }
         return this is Placeable