Page MenuHomeWildfire Games

Properly sort selected entities by owner
ClosedPublic

Authored by Imarok on Feb 3 2017, 11:11 PM.
Tags
None
Referenced Files
F5263972: D123.diff
Sat, Oct 5, 11:31 PM
F5260763: D123.diff
Sat, Oct 5, 6:25 AM
Unknown Object (File)
Wed, Oct 2, 11:24 AM
Unknown Object (File)
Wed, Sep 25, 5:20 AM
Unknown Object (File)
Sat, Sep 14, 7:05 AM
Unknown Object (File)
Sat, Sep 7, 8:37 PM
Unknown Object (File)
Sat, Sep 7, 5:14 PM
Unknown Object (File)
Fri, Sep 6, 1:42 AM
Subscribers

Details

Summary

Instead of using this hack with the modified template name (e.g. p3&foo) everywhere, now EntityGroups uses this "extended" template name only internally as key to sort by owner and template. So nothing besides EntityGroups needs to know about how this key is constructed.
Fixes #4425. refs #1807, #4167.
Fixes rP18979

Test Plan

Tested entity selection groups, adding and removing enitities from a group.
Tested control groups.
Set a rallypoint on a huntable animal, train a unit. The unit should move to the animal and kill/gather it.
Alt+doubleclick on some units like women, traders and military units (since that was broken in one of the predecessors of rP18979)

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Imarok added a reviewer: mimo.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/308/ for more details.

mimo requested changes to this revision.Feb 4 2017, 12:42 PM

The selectionGroupName is lost with this patch. That is used when we want units with different templates to be grouped together (typically to group basic, advanced and elite units). I've noticed two places where changes are needed, but there may be more.

binaries/data/mods/public/gui/session/selection.js
66 ↗(On Diff #443)

shouldn't it be key = "p" + ... + "&" + key; as we want to keep the selectionGroupName if any (so that basic, advanced and elite are grouped together).

binaries/data/mods/public/gui/session/selection_panels.js
459 ↗(On Diff #443)

I think you should do add
templateName = GetTemplateData(entState.template).selectionGroupName || entState.template;

and use that in 461

This revision now requires changes to proceed.Feb 4 2017, 12:42 PM

Will update soon

binaries/data/mods/public/gui/session/selection.js
66 ↗(On Diff #443)

True. I wanted to do that, but seems like I didn't ^^

binaries/data/mods/public/gui/session/selection_panels.js
459 ↗(On Diff #443)

You are right.

Imarok edited edge metadata.

Use selectionGroupName

Looks good to me now. Thanks, that will solve a longstanding issue!
I'll do some tests and accept it later.

binaries/data/mods/public/gui/session/selection.js
51 ↗(On Diff #448)

not necessary for the patch, but as you modify this function, we could have "if (this.ents[ent]) continue;" here

binaries/data/mods/public/gui/session/selection_panels.js
940 ↗(On Diff #448)

missing semicolon

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/311/ for more details.

Tests are ok, so revision accepted after fixing at least the semicolon.

This revision is now accepted and ready to land.Feb 4 2017, 8:59 PM

Add forgotten semicolon and some style fix

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/323/ for more details.

Thanks for the changes; The acceptation still holds :-)

This revision was automatically updated to reflect the committed changes.