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

Fix production queue numbers increasing needlessly. #15217

Merged
merged 1 commit into from Jun 11, 2018

Conversation

Projects
None yet
3 participants
@extmind
Copy link
Contributor

extmind commented Jun 6, 2018

Fixes production queue numbers increasing while previous buildings already disappeared. The number assigned to a new queue is decreased to the least highest number available. This approach may still leave lower numbers unused, but avoids confusing players by reusing or renaming queues that are in use.

Closes #15050.

@@ -36,17 +36,24 @@ public void Update(IEnumerable<ProductionQueue> allQueues)
{
var queues = allQueues.Where(q => q.Info.Group == Group).ToList();
var tabs = new List<ProductionTab>();
var removed = new List<int>();

This comment has been minimized.

@pchote

pchote Jun 6, 2018

Member

You can avoid allocating this list by keeping track of an int largestUsedName that you update when enumerating the tabs, then set NextQueueName to that + 1 after the loop.

@extmind extmind force-pushed the extmind:issue-15050 branch from 02843b9 to 559bab0 Jun 6, 2018

@extmind

This comment has been minimized.

Copy link
Contributor Author

extmind commented Jun 6, 2018

I applied your comment and updated the changes accordingly.

@pchote

pchote approved these changes Jun 11, 2018

Copy link
Member

pchote left a comment

LGTM 👍. Thanks for the fix!

@pchote pchote merged commit 314169f into OpenRA:bleed Jun 11, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.