-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show Waypoint Type in WaypointInfoWidget #1104
base: master
Are you sure you want to change the base?
Conversation
lordfolken
commented
Jan 29, 2023
Two questions:
|
Converting to draft. Windows doesn't compile. I have a proper implementation for that, but it ends up with an assertion: |
6b975a1
to
4f21f65
Compare
I saw that there was another similar construct in dlgWaypointEdit.cpp will try to refactor. |
The Engine (and any low-level code) should not have anything UI or language related. |
@@ -44,3 +45,26 @@ Waypoint::Project(const FlatProjection &projection) noexcept | |||
flat_location_initialised = true; | |||
#endif | |||
} | |||
|
|||
std::map<Waypoint::Type, tstring> Waypoint::TypeMap = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What could be a simple plain array, initialised at compile-time into .rodata
, is now a runtime-initialised std::map
with lots of heap allocations, with a complicated lookup procedure.
@@ -108,6 +108,8 @@ WaypointInfoWidget::Prepare(ContainerWindow &parent, | |||
if (!waypoint->comment.empty()) | |||
AddMultiLine(waypoint->comment.c_str()); | |||
|
|||
AddReadOnly(_("Waypoint type"), nullptr, Waypoint::TypeMap[waypoint->type].c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will crash if the type happens not to be in that std::map
.