Removing an upgrade from the build queue must also remove what depends on it
The queue holds farm level 2, then 3, then a hall upgrade that needs that farm. The player deletes the first entry and the rest sit there, waiting forever for something that will never come, while their cost stays locked up. This entry shows how to clean the queue in one pass and keep the rest in order.
Why this works
Things in a queue depend on each other, and pulling one out leaves its dependants hanging on nothing. Finding everything that rests on it, however far down the chain, and removing exactly that set, keeps the queue honest without wiping out what still stands on solid ground.
When not to use it
Skip it when jobs in your queue are independent, so any can be removed without affecting the others, or when you would rather ask the player what to do with the dependants. Then remove only the chosen job and show a gentle warning.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 30 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Removing an upgrade from the build queue must also remove what depends on it" (read_entry removing-one-queued-upgrade-removes-those-built-on-it) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP