-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix distributing food with empties containers #41232
Conversation
Note that `omt_pos` is a global coordinate.
Multiple things in one commit because this is basically a complete rewrite of the existing code. The existing code doesn't handle food in containers correctly. It gets a list of pointers to the items within a container, and clears the content of that container. Now those pointers are all dangling, but they are used nonetheless. That'll cause UB. Empty containers were dropped on a special tile, with **global** coordinates (omt_pos is global). This has been fixed, but it will still teleport items randomly without any sense. Code was restructured by using lambdas to create separate parts.
…mp food Instead just keep the container where it is.
Does that make the containers disapear? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support KorGgenT's mission to get rid of auto when we know a function's return, but other than that minor quibble, this looks great. Thanks for fixing this!
If I'm reading this correctly, the containers will be left in place, because the contents are removed in consume()
. Seems like a sensible solution.
Co-authored-by: Mark Langsdorf <[email protected]>
Fix distributing food with empties containers (CleverRaven#41232)
SUMMARY: None
Fixes #37149. It rewrites the whole food distributing block, and thereby also fixes #40712.
I also removed the littering feature. It would teleport empty contains on a specific area (using magic values as coordinates) with no regard for the surround (e.g. into fire, or into an enclosed area).