Skip to content

Fix parallel queues not pausing production for more than one of same item queued#21480

Merged
abcdefg30 merged 1 commit into
OpenRA:bleedfrom
cameo-mod:ppqpause
Sep 19, 2024
Merged

Fix parallel queues not pausing production for more than one of same item queued#21480
abcdefg30 merged 1 commit into
OpenRA:bleedfrom
cameo-mod:ppqpause

Conversation

@tjk-ws

@tjk-ws tjk-ws commented Jul 6, 2024

Copy link
Copy Markdown
Contributor

Parallel production queues did not pause production if more than one of the paused item was queued, because not all instances queued were paused and it simply moved on to producing the next one that was in the queue. This PR fixes it by pausing all instances of the paused item in the queue

@tjk-ws tjk-ws changed the title Fix parallel queues not pausing production when more than one item is… Fix parallel queues not pausing production for more than one item Jul 6, 2024
@tjk-ws tjk-ws changed the title Fix parallel queues not pausing production for more than one item Fix parallel queues not pausing production for more than one of same item queued Jul 6, 2024
protected override void PauseProduction(string itemName, bool paused)
{
foreach (var item in Queue.FindAll(a => a.Item == itemName))
item?.Pause(paused);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like the following would suffice? (for both overrides)

foreach (var item in Queue.Where(a => a.Item == itemName))
    item.Pause(paused);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

@PunkPun PunkPun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you provide a reproduction case? And also if this is a regression it would be nice to see which PR regressed it

@tjk-ws

tjk-ws commented Jul 8, 2024

Copy link
Copy Markdown
Contributor Author

Could you provide a reproduction case? And also if this is a regression it would be nice to see which PR regressed it

Change any of the classicproductionqueues in RA's player.yaml to a classicparallelproductionqueue, queue up more than one of an item, and try to pause production. Previously it only displayed paused on the widget but cash was still drained (as it moved on to producing the next one queued)

@RoosterDragon

Copy link
Copy Markdown
Member

Can confirm those reproduction steps replicate the issue, and that this PR fixes it.

@abcdefg30 abcdefg30 merged commit b5b16df into OpenRA:bleed Sep 19, 2024
@abcdefg30

Copy link
Copy Markdown
Member

Changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants