Skip to content

Use top-left grid cell when syncing staff charges#8501

Open
StephenCWills wants to merge 1 commit intodiasurgical:masterfrom
StephenCWills:staff-recharge-grid-index
Open

Use top-left grid cell when syncing staff charges#8501
StephenCWills wants to merge 1 commit intodiasurgical:masterfrom
StephenCWills:staff-recharge-grid-index

Conversation

@StephenCWills
Copy link
Copy Markdown
Member

This resolves #8500

@StephenCWills StephenCWills added the fix fix for a bug label Mar 8, 2026
@morfidon
Copy link
Copy Markdown

morfidon commented Mar 8, 2026

LGTM

This seems reasonable to me. InvGrid already treats negative entries as part of the same item in other places, so using std::abs(...) here looks like a consistency fix rather than a workaround.

@StephenCWills
Copy link
Copy Markdown
Member Author

It's not about consistency or workaround. It needs to pass the index of the top-left grid cell to NetSendCmdChInvItem(). The top-left grid cell has a negative number in it for any item larger than 1x1 so we have to use std::abs() to find it. It's simply incorrect to do otherwise.

@StephenCWills
Copy link
Copy Markdown
Member Author

StephenCWills commented Mar 9, 2026

Now that I think about it, this fix only applies to the source-side of the communications. A malicious client could still force an OOB on a remote client by passing the wrong index. This fix isn't quite sufficient.

@StephenCWills StephenCWills marked this pull request as draft March 9, 2026 17:03
@StephenCWills StephenCWills force-pushed the staff-recharge-grid-index branch from 24c0a7c to 5ba1dad Compare March 9, 2026 22:30
@StephenCWills StephenCWills marked this pull request as ready for review March 9, 2026 22:31
@StephenCWills
Copy link
Copy Markdown
Member Author

I added validation on the receiving end so this should be ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue Report]: Staff recharge fails to sync, freezes remote player character

2 participants