Skip to content

Commit 4c4c202

Browse files
authored
Fix equipment removal (#646)
1 parent 316733a commit 4c4c202

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

engine/src/main/kotlin/world/gregs/voidps/engine/inv/ItemRemoved.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import world.gregs.voidps.network.login.protocol.visual.update.player.EquipSlot
99

1010
/**
1111
* An item slot updated to an item in an inventory.
12-
* @param inventory the inventory id the item is from
13-
* @param index the index in the inventory the item was from
12+
* @param inventory the inventory id the item was removed from
13+
* @param index the index in the inventory the item was in
1414
* @param item the previous state of the item before it was removed
1515
*/
1616
data class ItemRemoved(

engine/src/main/kotlin/world/gregs/voidps/engine/inv/transact/ChangeManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ChangeManager(
2525
*/
2626
fun track(from: String, index: Int, previous: Item, fromIndex: Int, item: Item) {
2727
if (previous.isNotEmpty()) {
28-
changes.add(ItemRemoved(from, fromIndex, previous))
28+
changes.add(ItemRemoved(inventory.id, index, previous))
2929
}
3030
if (item.isNotEmpty()) {
3131
changes.add(ItemAdded(inventory.id, index, item))

engine/src/test/kotlin/world/gregs/voidps/engine/inv/InventorySlotChangedTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class InventorySlotChangedTest {
5151
@Test
5252
fun `Track removals`() {
5353
var removals = 0
54-
itemRemoved("coins", inventory = "bank") {
54+
itemRemoved("coins", inventory = "inventory") {
5555
removals++
5656
}
5757

0 commit comments

Comments
 (0)