Skip to content

Commit

Permalink
Merge pull request #141 from n8rzz/feature/ATC-125
Browse files Browse the repository at this point in the history
feature/ATC-125
  • Loading branch information
n8rzz authored Nov 24, 2016
2 parents 840e073 + 876f022 commit 33f334b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

### Minor
- Refactors `canvasController.canvas_draw_sids` method to use `airport.sidCollection` instead of `airport.sid` [#144](https://github.com/n8rzz/atc/issues/144)

- Moves creation of Legs and Waypoints to constants instead of as method arguments [#135](https://github.com/n8rzz/atc/issues/135)



Expand Down
18 changes: 11 additions & 7 deletions src/assets/scripts/aircraft/AircraftFlightManagementSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ export default class AircraftFlightManagementSystem {
insertWaypointHere(data) {
const airport = window.airportController.airport_get();
const prev = this.currentWaypoint;
const waypointToAdd = new Waypoint(data, airport);

// TODO: split this up into smaller chunks
this.currentLeg.waypoints.splice(this.current[WAYPOINT_WITHIN_LEG], 0, new Waypoint(data, airport));
this.currentLeg.waypoints.splice(this.current[WAYPOINT_WITHIN_LEG], 0, waypointToAdd);
this.update_fp_route();

// TODO: these if blocks a repeated elsewhere, perhaps currentWaypoint can handle this logic?
Expand All @@ -197,8 +198,9 @@ export default class AircraftFlightManagementSystem {
}

const prev = this.currentWaypoint;
// TODO: split up into smaller chunks
this.legs.splice(data.firstIndex, 0, new Leg(data, this));
const legToAdd = new Leg(data, this)

this.legs.splice(data.firstIndex, 0, legToAdd);

this.update_fp_route();

Expand Down Expand Up @@ -235,8 +237,9 @@ export default class AircraftFlightManagementSystem {
* Insert a Leg at the end of the flightplan
*/
appendLeg(data) {
// TODO: split this up into smaller chunks
this.legs.push(new Leg(data, this));
const legToAdd = new Leg(data, this);

this.legs.push(legToAdd);
this.update_fp_route();
}

Expand All @@ -245,8 +248,9 @@ export default class AircraftFlightManagementSystem {
*/
appendWaypoint(data) {
const airport = window.airportController.airport_get();
// TODO: split this up into smaller chunks
this.currentLeg.waypoints.splice(this.current[WAYPOINT_WITHIN_LEG] + 1, 0, new Waypoint(data, airport));
const waypointToAdd = new Waypoint(data, airport);

this.currentLeg.waypoints.splice(this.current[WAYPOINT_WITHIN_LEG] + 1, 0, waypointToAdd);
this.update_fp_route();
}

Expand Down

0 comments on commit 33f334b

Please sign in to comment.