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

Delete unused recipe rows in the production table #172

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

DaleStan
Copy link
Contributor

@DaleStan DaleStan commented Jul 6, 2022

This is a follow-up to #168. After adding all the recipes in existence, I want to delete the ones the solver decided not to use. It can be merged without #168, if desired.

This adds two buttons to the dropdown on the Recipe column:
image

The first button deletes all recipe rows that have zero assigned buildings, recursively through all nested tables.
The second button also unpacks any nested tables that only have a header recipe.

Given this nested table,
image
the first button converts it to this
image
and the second button converts it to this
image

Omit 1c0d336 to omit the second button. I can create a new PR if that's desired.

Required additional work

  • The undo system cannot reliably undo the actions performed by either of these new buttons. I haven't been able to figure out what I'm doing wrong, so I've marked this as a draft.

Potential future concerns

@@ -228,6 +229,40 @@ private void CalculateFlow(RecipeRow include)
flow = flowArr;
}

public void RemoveUnusedRecipes(bool unpackToo)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried spamming calls to RecordUndo in this method, but that sent the undo system into a stack overflow loop, both with and without unpacking.

@DaleStan
Copy link
Contributor Author

DaleStan commented Jul 6, 2022

Here's a demonstration of me mis-handling the undo system. Load DeleteUnusedTest.yafc.zip with this mod list, and use either of the two new buttons. Then try to undo the changes. After undo, the page will unexpectedly consume five of the six "Purified *" items, among other things. It will also unexpectedly produce gold ore, titanium sheet coil, uranium ore, nickel carbonyl, and tungsten ore.

If the modlist doesn't work, you should also be able to sync with this save: DeleteUnusedTest.zip

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.

None yet

2 participants