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: 7f5d420519aa
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5743e3b42399
Choose a head ref
  • 4 commits
  • 4 files changed
  • 1 contributor

Commits on Aug 1, 2020

  1. Fix the scimas bug

    eggrobin committed Aug 1, 2020
    Copy the full SHA
    9ea6d91 View commit details
  2. Fix the Butcher bug

    eggrobin committed Aug 1, 2020
    Copy the full SHA
    fdbd89d View commit details
  3. investment

    eggrobin committed Aug 1, 2020
    Copy the full SHA
    7ee863c View commit details

Commits on Aug 2, 2020

  1. Merge pull request #2660 from eggrobin/insert

    Fix a couple of bugs in flight plan rebasing
    eggrobin authored Aug 2, 2020
    Copy the full SHA
    5743e3b View commit details
Showing with 20 additions and 4 deletions.
  1. +6 −1 ksp_plugin/vessel.cpp
  2. +3 −1 ksp_plugin/vessel.hpp
  3. +6 −2 ksp_plugin_adapter/differential_slider.cs
  4. +5 −0 ksp_plugin_adapter/flight_planner.cs
7 changes: 6 additions & 1 deletion ksp_plugin/vessel.cpp
Original file line number Diff line number Diff line change
@@ -322,8 +322,13 @@ Status Vessel::RebaseFlightPlan(Mass const& initial_mass) {
}
not_null<std::unique_ptr<FlightPlan>> const original_flight_plan =
std::move(flight_plan_);
Instant const new_desired_final_time =
new_initial_time >= original_flight_plan->desired_final_time()
? new_initial_time + (original_flight_plan->desired_final_time() -
original_flight_plan->initial_time())
: original_flight_plan->desired_final_time();
CreateFlightPlan(
original_flight_plan->desired_final_time(),
new_desired_final_time,
initial_mass,
original_flight_plan->adaptive_step_parameters(),
original_flight_plan->generalized_adaptive_step_parameters());
4 changes: 3 additions & 1 deletion ksp_plugin/vessel.hpp
Original file line number Diff line number Diff line change
@@ -151,12 +151,14 @@ class Vessel {
virtual void DeleteFlightPlan();

// Requires |has_flight_plan()|.
// if |history_->back().time| lies within a planned manœuvre, UNAVAILABLE is
// If |history_->back().time| lies within a planned manœuvre, UNAVAILABLE is
// returned.
// Otherwise, deletes |flight_plan_| and recreates it from the current
// |history_| and the given |initial_mass|, re-adding any future manœuvres.
// Past manœuvres are discarded, under the assumption that they have been
// performed.
// If |history_->back().time| is greater than the current desired final time,
// the flight plan length is kept; otherwise, the desired final time is kept.
Status RebaseFlightPlan(Mass const& initial_mass);

// Tries to replace the current prediction with a more recently computed one.
8 changes: 6 additions & 2 deletions ksp_plugin_adapter/differential_slider.cs
Original file line number Diff line number Diff line change
@@ -67,6 +67,11 @@ public double value {
}
}

public void ResetValue(double new_value) {
value_ = null;
value = new_value;
}

// Renders the |DifferentialSlider|. Returns true if and only if |value|
// changed.
public bool Render(bool enabled) {
@@ -153,8 +158,7 @@ public bool Render(bool enabled) {
if (UnityEngine.GUILayout.Button("0", GUILayoutWidth(1))) {
value_changed = true;
// Force a change of value so that any input is discarded.
value_ = null;
value = zero_value_;
ResetValue(zero_value_);
}
if (slider_position_ != 0.0) {
value_changed = true;
5 changes: 5 additions & 0 deletions ksp_plugin_adapter/flight_planner.cs
Original file line number Diff line number Diff line change
@@ -234,6 +234,11 @@ private void RenderFlightPlan(string vessel_guid) {
vessel_guid, predicted_vessel.GetTotalMass());
UpdateStatus(status, null);
if (status.ok()) {
// The final time does not change, but since it is displayed with
// respect to the beginning of the flight plan, the text must be
// recomputed.
final_time_.ResetValue(
plugin.FlightPlanGetDesiredFinalTime(vessel_guid));
return;
}
}