Skip to content
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

discount loaded ammo from smoking rack even when not allowing removal #76500

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

PatrikLundell
Copy link
Contributor

@PatrikLundell PatrikLundell commented Sep 17, 2024

Summary

None

Purpose of change

Address one issue related to #59189, i.e. charcoal kiln reloading reloads max capacity even when partially filled.
Not sure if it does address the whole issue.

Describe the solution

Move the code for detecting existing contents out of the remove allowed only section so the existing contents is actually discounted when refilling the furniture.

The operation changed has a parameter specifying whether contents can be removed in the operation or not, and it cannot be removed in this call chain. There is another call chain where removal is permitted, though. There's no need for removal within the loading in this call chain, as there's a separate removal choice in the menu invoking the operation.

Describe alternatives you've considered

The code is weird in that it allows for multiple types of "ammo", but only carries a single pointer out of the loop. The check further down complaining about mixing ammo seems to indicate you're only supposed to have a single type of ammo at a time in furniture (e.g. either coal or charcoal, but not a bit of both). Thus, the moved code doesn't add up different kinds of ammo (it didn't for the remove permitted case either). The option would be to somehow permit a mixture of ammo, but that seems to be an expansion of functionality out of scope and with the potential of bringing in new worm cans.

Testing

  • Load a save with an overloaded smoking rack (because of this bug).
  • Empty the rack.
  • Load the rack, and the code selects a box with 200 charcoal.
  • Load the rack again and the UI states that it can take 89800 charcoal and it selects another box with 200 charcoal (I'm given a choice in neither case).
  • Load the rack again and the UI states that it can take 89600 charcoal and it selects a pile of more than 90000 charcoal (possibly the pile just unloaded, but who knows what pile it selects).
  • The rack now contains 90000 charcoal and is claimed to be full.

Additional context

I have made no attempt to check whether the error message about overloaded racks goes away when you no longer can overload racks (and have emptied and optionally reloaded ones already overloaded, of course), but expect that to be the case.

@github-actions github-actions bot added the [C++] Changes (can be) made in C++. Previously named `Code` label Sep 17, 2024
@PatrikLundell PatrikLundell changed the title discount loaded ammo even when not allowing removal discount loaded ammo from smoking rack even when not allowing removal Sep 17, 2024
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Sep 17, 2024
@Maleclypse Maleclypse merged commit eba7ec6 into CleverRaven:master Sep 19, 2024
25 of 30 checks passed
@PatrikLundell PatrikLundell deleted the load_furniture branch September 19, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants