Ticket #1210 (closed enhancement: fixed)

Opened 14 months ago

Last modified 13 months ago

[PATCH] Player should be able to train units over all buildings in a selection.

Reported by: michael Owned by: Spahbod
Priority: Should Have Milestone: Alpha 10
Component: UI & Simulation Keywords: patch
Cc:

Description

Players should be able to train units in multiple buildings in a selection at the same time. For instance, if multiple Barracks are selected (usually via double click), then if the player clicks the "train spearman" button, a spearman should be added to the queues of all of the selected barracks. This removes unnecessary clicks and helps prevent carpal tunnel and tendonitis in players (known from experience).

Attachments

Commands.js.patch (1.8 KB) - added by Spahbod 14 months ago.
input.js.patch (3.3 KB) - added by Spahbod 14 months ago.
ticket-1210-2012-4-20.patch (3.7 KB) - added by Spahbod 13 months ago.

Change History

comment:1 Changed 14 months ago by k776

  • Priority changed from Must Have to Nice to Have
  • Component changed from Game engine to Simulation

comment:2 Changed 14 months ago by Spahbod

These files contain some modifications from #1215 & #1209. So it is better to apply the patches in those tickets first before this to prevent unwanted errors.

comment:3 Changed 14 months ago by k776

  • Keywords patch, review added; buildings "unit training" multi-selection multiple selection removed
  • Owner set to Spahbod
  • Summary changed from Player should be able to train units over all buildings in a selection. to [PATCH] Player should be able to train units over all buildings in a selection.

comment:4 Changed 14 months ago by mammadori

"This removes unnecessary clicks and helps prevent carpal tunnel and tendonitis in players (known from experience)."

Regarding this definition I think this could be related also with #1226, in 1226 there is the code to queue a unit in all selected buildings, in a positional (and easy to remember) way. ZXCV keys queue to 1234 kind of unit.

Changed 14 months ago by Spahbod

Changed 14 months ago by Spahbod

comment:5 Changed 14 months ago by Spahbod

Simplified the patch according to instructions from Philip.

comment:6 Changed 14 months ago by leper

Just noticed that this ticket is a dupe of #959 (maybe except the rally point setting, but that is already implemented).

Last edited 14 months ago by leper (previous) (diff)

comment:7 follow-up: ↓ 9 Changed 14 months ago by leper

  • Keywords patch added; patch, review removed

I took a look at your patch and you could improve it a bit:

  • You should use FilterEntitiesList?(cmd.entities, player, controlAllUnits) in Commands.js instead of the if block.
  • Remove entity and replace it with entities altogether. This way you can use the loop code for both cases in Commands.js

Apart from those points it is looking good. It would be good if you could try to provide a single patch file that only includes changes relevant to this ticket and maybe timestamp your patch.

comment:8 Changed 13 months ago by michael

  • Priority changed from Nice to Have to Should Have

comment:9 in reply to: ↑ 7 Changed 13 months ago by Spahbod

Replying to leper:

I took a look at your patch and you could improve it a bit:

  • You should use FilterEntitiesList?(cmd.entities, player, controlAllUnits) in Commands.js instead of the if block.
  • Remove entity and replace it with entities altogether. This way you can use the loop code for both cases in Commands.js

Apart from those points it is looking good. It would be good if you could try to provide a single patch file that only includes changes relevant to this ticket and maybe timestamp your patch.

Sorry for the delay. About first point:That should work. but i did that because we need the player be able to control the first selected building (which is entity or entities[0]). But there is also a problem. It seems that FilterEntitiesList? can't be used in Command.js so I hardcoded the thing.

If we remove "entity" it causes the AI to stop training units. That needs a much broader change that needs quantumstate's approval.

Changed 13 months ago by Spahbod

comment:10 Changed 13 months ago by Spahbod

Feel free to change the patch if necessary if i didn't return for so long.

comment:11 Changed 13 months ago by k776

  • Keywords review added

comment:12 Changed 13 months ago by leper

  • Status changed from new to closed
  • Resolution set to fixed

In 11592:

Allow training in all selected buildings. Fixes #1210.

comment:13 Changed 13 months ago by leper

  • Keywords review removed

Thanks for your patch. I rewrote most of it as some of the code was changed by r11584 and my version adds the ability to add to batches if we have more than one building selected.

Note: See TracTickets for help on using tickets.