Page MenuHomeWildfire Games

Gamesetup colors property to fix autocompleting of colored dropdown items
ClosedPublic

Authored by elexis on May 6 2017, 9:50 PM.

Details

Summary

While it didn't hurt much to autocomplete the string [color=\"orange\"]Random[/color], it is annoying not to be able to autocomplete observer names in the gamesetup.
By adding a new property "colors" to g_Dropdowns and g_PlayerDropdowns, we can separate the label string and it's color cleanly, thereby fix the bug and remove some color tag duplication as well.

Test Plan

Open a multiplayer gamesetup, unassign yourself, try to autocompelte your playername in the chat. Will work with the patch but not without.
Press F9 and type warn(uneval(g_Autocomplete)) and see color tagged strings in there without the patch but not if applied.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.May 6 2017, 9:50 PM
Vulcan added a subscriber: Vulcan.May 6 2017, 10:37 PM

Build is green

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

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

Imarok accepted this revision.May 8 2017, 11:07 PM
Imarok added a subscriber: Imarok.

Looks good. Works.

binaries/data/mods/public/gui/gamesetup/gamesetup.js
562 ↗(On Diff #1694)

Is that || [] really needed?

This revision is now accepted and ready to land.May 8 2017, 11:07 PM
Imarok added inline comments.May 8 2017, 11:09 PM
binaries/data/mods/public/gui/gamesetup/gamesetup.js
1282 ↗(On Diff #1694)

Why not using unshift?

elexis marked 2 inline comments as done.May 9 2017, 1:17 AM

Thanks for the review!

binaries/data/mods/public/gui/gamesetup/gamesetup.js
562 ↗(On Diff #1694)

Since the g_PlayerAssignmentList is empty until the local client join was finished, it will complain about missing Name property until then

1282 ↗(On Diff #1694)

Oh yes, that's nicer. Never really had the pleasure of taking advantage of this statement.

This revision was automatically updated to reflect the committed changes.
elexis marked 2 inline comments as done.
elexis added inline comments.May 9 2017, 1:36 AM
binaries/data/mods/public/gui/gamesetup/gamesetup.js
19 ↗(On Diff #1694)

Also used for the playername label, but works for me

980 ↗(On Diff #1694)

Adding \n after =>

1279 ↗(On Diff #1694)

This sorts in place and returns the new array, so only half of that line is actually needed.

elexis added a comment.May 9 2017, 4:21 AM

Now we can't type mapnames and playernames anymore to select the according dropdown item because of the explicit color.
But we couldn't type observernames before, so doing the right fix seems better: D462