Skip to content

Commit

Permalink
Set ItemManager index to correct value after ReceivedItems (#193)
Browse files Browse the repository at this point in the history
I noticed in the CrossCode APWorld that every time an item was received,
my client would send a `Sync` Packet and the server would, naturally,
respond with a `ReceivedItems` packet with `index=0`. This turned out to
be an oversight in `ItemsManager.#onReceivedItems` in which the program
would fail to update `#index` to the new value, therefore keeping
`#index` constantly at zero, and creating some unnecessary network
bandwidth. This PR adds a whopping one line of code that should fix this
issue.
  • Loading branch information
ThePhar authored Nov 4, 2024
2 parents f2a4b2e + fc7e1fd commit fe0e98f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/managers/ItemsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,7 @@ export class ItemsManager {
for (const item of packet.items) {
this.#items[index++] = item;
}

this.#index = index;
}
}

0 comments on commit fe0e98f

Please sign in to comment.