#515 closed enhancement (fixed)
Doubleclicking a unit should select all similar units on screen
Reported by: | Christoph Seipel | Owned by: | Evans |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 3 |
Component: | Core engine | Keywords: | |
Cc: | Philip Taylor | Patch: |
Description
When doubleclicking a unit, you should select all units of the same type which are visible at once. This behavior was described in input.js comments, but not yet implemented.
With this ticket I supply a patch, implementing this feature.
Attachments (4)
Change History (21)
by , 14 years ago
Attachment: | doubleclick.patch added |
---|
comment:1 by , 14 years ago
I submitted a new patch. trippleclick.patch, that implements both, double and tripple-click selection. A tripple click selects all units of the same type on the map belonging to the player.
doubleclick.patch is obsolete, as the changes are included in trippleclick.patch.
by , 14 years ago
Attachment: | trippleclick.patch added |
---|
implements double and triple-click selection. Updated, after a used function has changed.
comment:2 by , 14 years ago
Keywords: | review removed |
---|
Thanks for this! It looks like it works well, but there's a few changes I'd like to see.
Instead of picking entities based on the actor name, it would be better to use the entity template name (i.e. the XML file used to load the entity). (Some units might not have an actor, some different units might have the same actor, no actors will be loaded if the game is run in a non-graphical mode, etc.)
To do that, it seems most efficient to add a method to ICmpTemplateManager
like GetEntitiesUsingTemplate(templateName)
, and implement it in CCmpTemplateManager
to loop over m_LatestTemplates
and return a list of matching entities.
Then PickSimilarEntities
can call that method to get a list of similar entities, then filter out the ones that are off-screen etc like it does now, and return that list.
In the future we might want new ways of picking entities, e.g. double-click on a unit icon in the panel at the bottom of the screen to select all units of the same type, or something like that. So I'd prefer PickSimilarEntities
to be a bit more flexible: instead of passing in screenX
and screenY
as arguments, just pass the entity template name to match. Then the GUI scripts can call PickEntitiesAtPoint
and Engine.GuiInterfaceCall("GetEntityState", ent).template
to work out what template name to select, or (in the future) could use some other method to choose a name, before picking all entities with that name.
I think the patch will be fine after those changes. (But please let me know if anything I'm saying is unclear and/or crazy.)
comment:3 by , 14 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
That suggestions make sense. As i am very new to 0ad development i have chosen this task to get into the codebase. I appreciate your explanations and will improve the patch next week.
comment:5 by , 13 years ago
Milestone: | → OS Alpha 2 |
---|
comment:6 by , 13 years ago
Summary: | Doubleckicking a unit should select all similar units on screen → Doubleclicking a unit should select all similar units on screen |
---|
comment:7 by , 13 years ago
Milestone: | OS Alpha 2 → OS Alpha 3 |
---|
comment:8 by , 13 years ago
Priority: | minor → major |
---|
comment:10 by , 13 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
I have so much to do with other things (work) at present. I don't think i will find time to to this until Alpha 3.
by , 13 years ago
Attachment: | TripleClick.patch added |
---|
comment:11 by , 13 years ago
Cc: | added |
---|---|
Owner: | set to |
Status: | new → assigned |
I have added a patch based on Christoph's patch - implementing Philip's comments.
comment:12 by , 13 years ago
Keywords: | review added |
---|
Added the review keyword as I assume this should be reviewed :)
comment:13 by , 13 years ago
Just some minor things:
EntitySelection::PickSimilarEntities
:
I think this might accidentally select garrisoned units, since it doesn't check IsInWorld
. It should probably just include the GetLosVisibility
check (as with the other Pick
functions) which will exclude out-of-world units.
The GetCurrentTemplateName
check seems unnecessary, since GetEntitiesUsingTemplate
shouldn't return any entities that fail the test.
The whole cmpVisual
thing should probably be inside an if (onScreenOnly)
, so that we don't waste time getting the position unless we're actually going to check its visibility.
CCmpTemplateManager::GetEntitiesUsingTemplate
should just use ==
instead of .compare
by , 13 years ago
Attachment: | TripleClick.2.patch added |
---|
comment:15 by , 13 years ago
Thanks! Applying with minor changes. Moved the GetLosVisibility
check back out of the if (onScreenOnly)
, because otherwise triple-clicks will still select garrisoned units which seems confusing. Cleaned up the comments a bit - "" should always be followed by a space, "occured" should be "occurred", PickSimilarEntities
comment wasn't updated. The latest patch also includes some garrison changes, which I assume aren't meant to be part of this, so I'll skip them.
comment:16 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:17 by , 8 years ago
Keywords: | review removed |
---|
Patch implementing multiple selection per double-click