Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 485c0c60ea47
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 70cfb93ae979
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on May 26, 2019

  1. Copy the full SHA
    5751838 View commit details
  2. Merge pull request #2178 from pleroy/2176b

    Run the callback the first time the frame changes after construction
    pleroy authored May 26, 2019
    Copy the full SHA
    70cfb93 View commit details
Showing with 5 additions and 1 deletion.
  1. +5 −1 ksp_plugin_adapter/reference_frame_selector.cs
6 changes: 5 additions & 1 deletion ksp_plugin_adapter/reference_frame_selector.cs
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ public ReferenceFrameSelector(ISupervisor supervisor,
// C++ side (we do for flight planning).
frame_type = FrameType.BODY_CENTRED_NON_ROTATING;
selected_celestial = FlightGlobals.GetHomeBody();
is_freshly_constructed_ = true;

expanded_ = new Dictionary<CelestialBody, bool>();
foreach (CelestialBody celestial in FlightGlobals.Bodies) {
@@ -388,15 +389,18 @@ private void EffectChange(Action action) {
var old_frame_type = frame_type;
var old_selected_celestial = selected_celestial;
action();
if (frame_type != old_frame_type ||
if (is_freshly_constructed_ ||
frame_type != old_frame_type ||
selected_celestial != old_selected_celestial) {
on_change_(FrameParameters());
is_freshly_constructed_ = false;
}
}

private readonly Callback on_change_;
private readonly string name_;
private Dictionary<CelestialBody, bool> expanded_;
private bool is_freshly_constructed_;
}

} // namespace ksp_plugin_adapter