Skip to content

feat: track stand assignment source with colour-coded tag items#610

Merged
kristiankunc merged 59 commits into
VATSIM-UK:mainfrom
MrAdder:issue-604a
Apr 23, 2026
Merged

feat: track stand assignment source with colour-coded tag items#610
kristiankunc merged 59 commits into
VATSIM-UK:mainfrom
MrAdder:issue-604a

Conversation

@MrAdder

@MrAdder MrAdder commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #604

⚠️ Hard dependency: VATSIM-UK/uk-controller-api#1817 needs to be deployed before this is merged.

Stand assignments now know how they were made. Whether a stand was assigned by a controller, auto-assigned by the system, or allocated by the reservation or VAA allocator, that information is now tracked and shown in EuroScope.

Tag item 110 shows the source as a colour-coded indicator — each source gets its own configurable colour saved to user settings. Tag item 200 gets a short suffix (USER, AUTO, RES , VAA ) so it's visible at a glance in the tag itself.

Also fixed a latent crash in FlightPlanEvent where a stale stand ID could cause a past-the-end dereference — it now logs a warning and returns early instead.

Under the hood:

  • Fixed linker errors by adding the new files to CMakeLists.txt (they were just missing)
  • Added missing direct #includes that were previously only pulled in transitively
  • Cleaned up the tests — extracted helpers and replaced a wall of near-identical test cases with table-driven loops

@MrAdder MrAdder left a comment

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.

Due to the changes to the test test/plugin/stands/StandEventHandlerTest.cpp to reduce duplication the test/plugin/ecfmp/AircraftFlowMeasureMapTest.cpp needed to be reworked as it pulled from it

Comment thread src/plugin/stands/StandAssignmentSource.h Outdated
@kristiankunc

Copy link
Copy Markdown
Contributor

Have you managed to test it locally?

@MrAdder

MrAdder commented Mar 17, 2026 via email

Copy link
Copy Markdown
Contributor Author

@MrAdder

MrAdder commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

So currently have API response from the logs highlighted response for user requested

image

Forgot to add the menu items so it wont render working on a build now, for some reason DevContainer give CURL errors so using the CI workflow for build

@MrAdder

MrAdder commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

Works also Adds a Tag item which is also shown in screenshots AUTO/USER/VAA(may be of use later when I dig into the API further possibly to tag Event Slots with for my other PR for the Event Planning system)

Not sure on the colour Selection as it brings up one window for USER you select Color then you Select the Color for AUTO, will quite happily take suggestions on that.

Still Tweaking but feel free to review while in Draft/Make Suggestions

image image image image

Restricted color Selector to just User and System Auto for now until functionality is worked in on API end
@19wintersp

Copy link
Copy Markdown
Contributor

I'll look at the code when this is out of draft.

Not sure on the colour Selection as it brings up one window for USER you select Color then you Select the Color for AUTO, will quite happily take suggestions on that.

I think the UX here could be improved somewhat; if it is to be made configurable like this, then at least a dialogue should be shown with a form containing the different options. Having popups appear and disappear in sequence with no feedback is not ideal.

Does this even need to be configurable? I think the colours could certainly be made into a loadable plugin setting, but I don't think they warrant having their own UI and a place in the (already quite full) OP menu. Open to discussion on this point, but adding another useless configuration item for users to pointlessly change seems unnecessary to me.

@CLC0609

CLC0609 commented Mar 17, 2026

Copy link
Copy Markdown

Completely agree, I don't think this needs to be configurable.

@MrAdder

MrAdder commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

Currently they are stored in the Data/Settings/Local/<AIRPORT>/Plugins.txt

UK Controller Plugin:stand_colour_user:255,128,128
UK Controller Plugin:stand_colour_reservation_allocator:255,0,0
UK Controller Plugin:stand_colour_vaa_allocator:128,255,128
UK Controller Plugin:stand_colour_system_auto:255,0,255

So potentially configurator change in the controller pack? so I can ditch the OP menu option

and I just change the defaults to white?

  • user = Controller changed
  • reservation_allocator = Requested stand by pilot
  • vaa_allocator = Is a potential WIP on the API side
  • system_auto = Generic stand allocation from the API

Also thank you for your inputs

@19wintersp

19wintersp commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

I see no need to move settings out of the Plugin and into the Configurator; I would leave the settings serialisation as-is, remove the configuration UI from this patch, and leave it to be set in the Pack. As above, I see no value in letting users change these colours; there is precedent enough for hard-coding things as these, though leaving it as a plugin setting seems a fair middle ground.

@MrAdder

MrAdder commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

Defaults are hard coded anyway (Shown below) I think the grey one for system needs to not be grey especially on some dark SMRs e.g. Heathrow, so going forward will remove the UI and leave in the Plugin setting options from above, and not worry about the configurator in the controller pack.

        static constexpr COLORREF DEFAULT_RESERVATION_COLOUR = RGB(255, 255, 0); // yellow
        static constexpr COLORREF DEFAULT_VAA_COLOUR = RGB(0, 255, 255);         // cyan
        static constexpr COLORREF DEFAULT_SYSTEM_COLOUR = RGB(180, 180, 180);    // grey

@kristiankunc

Copy link
Copy Markdown
Contributor

Agree with the points above - having a custom UI is overkill. Let's stick to 2/3 distict colors for now and KISS

@19wintersp

19wintersp commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

My suggestions for colours are as follows, with three options for how to map them to the various states: (edit: I have added Candidate as the provisional final choice; see later comments below)

Colour RGB Map A Map B Map C Candidate
White #ffffff User User Auto Auto, Unk
Grey #cccccc Auto, Unk Auto, Unk Unk
Yellow #ffd800 Res, VAA Res Res, VAA Res, VAA
Orange #ff9529 VAA User User

I've suggested merging "Auto" and "Unknown" in most of these options since the distinction is unlikely to be interesting to most users, and that we are quite insistent with plugin updates means any newly-added allocators server-side can be accompanied by a plugin update to add corresponding new colours if necessary. The colour distinction between "Auto" and "User" is also fairly subtle in most of the options, since again the distinction is not too important to the controller, who should be able to remember what they themselves have changed, however if we feel it is likely to be used similarly to reservations, I have separated it better in option C. I've merged "Reservation" and "VAA" in two of the options since I again think the distinction is unlikely to be useful to controllers (in both cases, they indicate a higher priority), but if we do consider it important then option B can be used.

The colours themselves have been chosen to try to provide reasonably good contrast on all surfaces on which they appear, whilst at least somewhat matching most of the existing datablock symbology colours. Here's an (approximate) preview, with the bottom row in each pair being with the strip selected:

image

Comments welcome from all

Add Unknown source colour and adjust default palette, include logger header, and simplify user-setting loading.

- Introduce DEFAULT_UNKNOWN_COLOUR and add StandAssignment::Source::Unknown into the sourceColours defaults and loading loop so unknown assignments have a defined colour.
- Update default colours for reservation, VAA and system to new values.
- Replace the custom SourceColourDefault struct with a simple array of sources and streamline reading colour entries from UserSetting.
- Add utils/log/LoggerFunctions.h and remove an unused stdexcept include.

Refactor StandEventHandler for clarity and correctness:

- Forward SetAssignedStand(callsign, id) to the source-aware overload to ensure assignments always have a source.
- Consolidate tag colour application so tag colour is set consistently.
- Reorder and clean up many methods (validation, message parsing, API requests, push event processing, flightplan handling, assignment/unassignment flows) for readability and maintainability without changing external behaviour.
- Fix some control flow and API handling points (mass assignment loading, push event processing, async API calls).

Overall this change improves colour handling for unknown sources and restructures the event handler code for clarity and consistency.
@MrAdder

MrAdder commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

Good colour selection IMO, will test it all once compiled again

MrAdder added 2 commits April 9, 2026 19:49
Update include path from utils/log/LoggerFunctions.h to log/LoggerFunctions.h to match refactored headers. Also correct the constexpr sourceColourDefaults array size from 4 to 5 to match the number of initializer elements, preventing mismatched-size/overflow issues.
@kristiankunc

kristiankunc commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

My take on the colours:
The fewer the better - we should not rely on controllers remembering more color codes than necessary. My favourite is scheme A where wer merge categories which require similar controller attention but imo the gray is barely distinguishable from the white, something which stands out a little more would be better. If there's a white A/C in the arrival list I would likely tell these apart but if not, I probably couldn't tell you which is which. Removing the gray in the A scheme and using white, yellow, orange sounds sensible to me.

Introduce a local alias `Source` for `StandAssignment::Source` and replace the verbose constexpr array initialization with a compact single-brace initializer for `sourceColourDefaults`. This reduces repetition, removes the extra nested-brace style, and improves readability.
@19wintersp

19wintersp commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

I'll defer my final review until the colours are decided, but if you could try to fix the new "code smell" (I'm happy to ignore the shadowing ones; probably a result of some other include) before then that would be great.

edit: I've actually had a quick look at the code; could the addition of the new DEFAULT_UNKNOWN_COLOUR be reverted before I review, please? I think it makes far more sense to have it the previous way, where the colour we will "assign" to the Unknown "type" is actually just the fallback colour, since otherwise the DEFAULT_COLOUR becomes basically unused.

My take on the colours: The fewer the better - we should not rely on controllers remembering more color codes than necessary. My favourite is scheme A where wer merge categories which require similar controller attention but imo the gray is barely distinguishable from the white, something which stands out a little more would be better. If there's a white A/C in the arrival list I would likely tell these apart but if not, I probably couldn't tell you which is which. Removing the gray in the A scheme and using white, yellow, orange sounds sensible to me.

I agree the grey and white are fairly similar; my original justification for that was that the distinction between Auto and User is also fairly subtle. However, I can now see how User may need to be flagged more evidently for cases where pilots verbally report a stand request to eg. AIR before handover to GMC, to which end I'd agree with your suggestion. Comments still universally welcome, of course, but I'll update the table accordingly.

MrAdder and others added 3 commits April 12, 2026 16:39
Replace the type alias with C++20's `using enum StandAssignment::Source` to bring enumerators into scope, and update the constexpr defaults array to use the fully-qualified enum type with unqualified enumerator initializers. This is a non-functional cleanup to reduce redundant qualification and improve readability.
Introduce C++20 'using enum' for StandAssignment::Source to allow unqualified enum constants, simplifying switch cases and initializer lists. Updates made in StandColourConfiguration.cpp, StandEventHandler.cpp and the corresponding test to improve readability with no behavioral changes.

Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com>
@MrAdder

MrAdder commented Apr 12, 2026

Copy link
Copy Markdown
Contributor Author

Sonar may still have 3 smells .... however will test this once its compiled

@kristiankunc

Copy link
Copy Markdown
Contributor

Let's see what Patrick think but I probably wouldn't stress over them to much - it's only the three shadowing ones. And if nobody else has got anything with the colors you can bake those in as well now.

@19wintersp

Copy link
Copy Markdown
Contributor

If the SonarQube analysis doesn't let you use using Source = ... in place of using enum ..., then I'd just ignore the warnings. As above, I think the colours are settled now, so please do ping me for review once those (and the other fixes I mentioned) are sorted

Comment thread src/plugin/stands/StandColourConfiguration.h Outdated
Replace DEFAULT_UNKNOWN_COLOUR with the shared DEFAULT_COLOUR for the Unknown StandAssignment source and remove the now-unused DEFAULT_UNKNOWN_COLOUR constant. This unifies the default gray value and reduces duplicated color definitions (updated StandColourConfiguration.cpp and StandColourConfiguration.h).
@kristiankunc

Copy link
Copy Markdown
Contributor

Have all the commenst been resolved?

@MrAdder

MrAdder commented Apr 22, 2026 via email

Copy link
Copy Markdown
Contributor Author

@kristiankunc kristiankunc requested a review from 19wintersp April 22, 2026 18:33

@19wintersp 19wintersp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Trivial things from a cursory overview; I will check fully once these are changed but hopefully that should be all.

Comment thread src/plugin/stands/StandColourConfiguration.cpp Outdated
Comment thread src/plugin/stands/StandColourConfiguration.h Outdated
MrAdder and others added 3 commits April 23, 2026 11:34
Co-authored-by: Patrick Winters <61561933+19wintersp@users.noreply.github.com>
Co-authored-by: Patrick Winters <61561933+19wintersp@users.noreply.github.com>
Wrap the source/color entries in an extra set of braces in StandColourConfiguration.cpp so the initializer is correctly interpreted for sourceColours (prevents ambiguous/invalid initializer parsing). Also normalize spacing of inline comments in StandColourConfiguration.h for consistent formatting.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@kristiankunc kristiankunc merged commit f43eb73 into VATSIM-UK:main Apr 23, 2026
3 of 4 checks passed
@VATSIMUK

Copy link
Copy Markdown

🎉 This PR is included in version 5.19.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show Pilot Requested stands differently to allocated stands

6 participants