Skip to content

Check the container weight when stacking an item on another one inside it - #1626

Open
DavideRei wants to merge 1 commit into
Sphereserver:devfrom
DavideRei:fix/stack-container-weight
Open

DavideRei wants to merge 1 commit into
Sphereserver:devfrom
DavideRei:fix/stack-container-weight

Conversation

@DavideRei

Copy link
Copy Markdown
Contributor

Description

Dropping an item on the same item inside a container stacks it, and the weight limit of the container wasn't checked: it was possible to overload a backpack or a bank box this way. Before stacking, check CanContainerHold on the container and on every container holding it. CItem::Stack gets a fCheckOnly argument to know if the two items would stack, and CanContainerHold a fStacking argument to skip the item count limits (stacking doesn't add an item to the container).


Type of Change

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation update
  • Build / CI change
  • Other (please describe): behaviour change

Related Issues

None.


Testing

  • Compiled with MSVC 2022 (Windows x64, Release) on top of the current dev.
  • The same change has been running on our shard (a private fork kept aligned with dev); the code in this PR was adapted to the current dev and was not tested in game in this form.
  • The container walk and the fStacking argument of CanContainerHold were written for this PR.

Checklist

  • Code compiles successfully
  • Changes follow the project's coding style
  • No unrelated code was modified
  • Documentation updated where necessary (Changelog.txt)
  • This PR does not introduce breaking changes (or they are documented)

Additional Notes

None.

🤖 Generated with Claude Code

…e it

Dropping an item on the same item inside a container stacks it, and the weight limit of the container wasn't checked:
it was possible to overload a backpack or a bank box this way.
Before stacking, check CanContainerHold on the container and on every container holding it. CItem::Stack gets a
fCheckOnly argument to know if the two items would stack, and CanContainerHold a fStacking argument to skip the item
count limits (stacking doesn't add an item to the container).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DavideRei
DavideRei force-pushed the fix/stack-container-weight branch from 0974e43 to e6c0ff3 Compare December 2, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant