-
Notifications
You must be signed in to change notification settings - Fork 69
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
Multiple flight plans #3400
Multiple flight plans #3400
Conversation
flight_plans_.emplace(it, std::get<serialization::FlightPlan>(original)); | ||
} else if (std::holds_alternative<not_null<std::unique_ptr<FlightPlan>>>( | ||
original)) { | ||
std::get<not_null<std::unique_ptr<FlightPlan>>>(original)->WriteToMessage( |
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 code is somewhat worrisome as it assumes that the serialized form can be freely copied. A comment would be welcome.
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.
Added a comment; the one we should adjust would probably not be this one anyway.
ksp_plugin/vessel.hpp
Outdated
serialization::FlightPlan> flight_plan_; | ||
std::vector<std::variant<not_null<std::unique_ptr<FlightPlan>>, | ||
serialization::FlightPlan>> flight_plans_; | ||
int selected_flight_plan_ = -1; |
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.
Could we make this an optional
? It would be safer, just say no to magic values.
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.
As discussed, this would probably not help readability.
Towards #3382.
This change extends the existing API of
Vessel
: in the absence of calls to the new functionsSelectFlightPlan
andDuplicateFlightPlan
, or to the pre-existingCreateFlightPlan
on a vessel with a flight plan, semantics are preserved.A vessel may now have up to 10 flight plans (labeled
A
throughJ
in English); they are deserialized lazily independently from each other. Additional flight plans are created either by pressing+
to add a new blank flight plan, or by duplicating an existing flight plan.For now, it is not possible to simultaneously display two flight plans; nor can flight plans be named or reordered.