flightConfiguration clone was creating two copies of each
MotorConfiguration.
This commit is contained in:
parent
8fb7d16a66
commit
470799da72
@ -39,9 +39,6 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
protected final Rocket rocket;
|
||||
protected final FlightConfigurationID fcid;
|
||||
|
||||
protected static int instanceCount=0;
|
||||
public final int instanceNumber;
|
||||
|
||||
private List<EventListener> listenerList = new ArrayList<EventListener>();
|
||||
|
||||
protected class StageFlags implements Cloneable {
|
||||
@ -94,8 +91,6 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
this.rocket = rocket;
|
||||
this.isNamed = false;
|
||||
this.configurationName = "<WARN: attempt to access unset configurationName. WARN!> ";
|
||||
instanceNumber = FlightConfiguration.instanceCount;
|
||||
++FlightConfiguration.instanceCount;
|
||||
|
||||
updateStages();
|
||||
updateMotors();
|
||||
@ -395,36 +390,6 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
updateMotors();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a motor instance to this configuration. The motor is placed at
|
||||
* the specified position and with an infinite ignition time (never ignited).
|
||||
*
|
||||
* @param id the ID of this motor instance.
|
||||
* @param motor the motor instance.
|
||||
* @param mount the motor mount containing this motor
|
||||
* @param ignitionEvent the ignition event for the motor
|
||||
* @param ignitionDelay the ignition delay for the motor
|
||||
* @param position the position of the motor in absolute coordinates.
|
||||
* @throws IllegalArgumentException if a motor with the specified ID already exists.
|
||||
*/
|
||||
// public void addMotor(MotorId _id, Motor _motor, double _ejectionDelay, MotorMount _mount,
|
||||
// IgnitionEvent _ignitionEvent, double _ignitionDelay, Coordinate _position) {
|
||||
//
|
||||
// MotorInstance instanceToAdd = new MotorInstance(_id, _motor, _mount, _ejectionDelay,
|
||||
// _ignitionEvent, _ignitionDelay, _position);
|
||||
//
|
||||
//
|
||||
// // this.ids.add(id);
|
||||
// // this.motors.add(motor);
|
||||
// // this.ejectionDelays.add(ejectionDelay);
|
||||
// // this.mounts.add(mount);
|
||||
// // this.ignitionEvents.add(ignitionEvent);
|
||||
// // this.ignitionDelays.add(ignitionDelay);
|
||||
// // this.positions.add(position);
|
||||
// // this.ignitionTimes.add(Double.POSITIVE_INFINITY);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Add a motor instance to this configuration.
|
||||
*
|
||||
@ -557,15 +522,10 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
*/
|
||||
@Override
|
||||
public FlightConfiguration clone() {
|
||||
// Note the motors and stages are updated in the constructor call.
|
||||
FlightConfiguration clone = new FlightConfiguration( this.getRocket(), this.fcid );
|
||||
clone.setName("clone - "+this.fcid.toShortKey());
|
||||
clone.listenerList = new ArrayList<EventListener>();
|
||||
for( StageFlags flags : this.stages.values()){
|
||||
clone.stages.put( flags.stage.getStageNumber(), flags.clone());
|
||||
}
|
||||
for( MotorConfiguration mi : this.motors.values()){
|
||||
clone.motors.put( mi.getID(), mi.clone());
|
||||
}
|
||||
clone.cachedBounds = this.cachedBounds.clone();
|
||||
clone.modID = this.modID;
|
||||
clone.boundsModID = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user