[refine] removed ~40% excess configuration clones while creating undo point.

This commit is contained in:
Daniel_M_Williams 2016-10-22 16:34:52 -04:00
parent 1c326c88c3
commit 31938d69d7

View File

@ -310,24 +310,11 @@ public class Rocket extends RocketComponent {
// Rocket copy is cloned, so non-trivial members must be cloned as well:
copy.stageMap = new HashMap<Integer, AxialStage>();
copy.configSet = new FlightConfigurableParameterSet<FlightConfiguration>( this.configSet );
new HashMap<FlightConfigurationId, FlightConfiguration>();
if( 0 < this.configSet.size() ){
Rocket.cloneConfigs( this, copy);
}
copy.listenerList = new ArrayList<EventListener>();
return copy;
}
private static void cloneConfigs( final Rocket source, Rocket dest ){
source.checkState();
dest.checkState();
dest.selectedConfiguration = source.selectedConfiguration.clone();
for( final FlightConfiguration config : source.configSet ){
dest.configSet.set( config.getId(), config.clone() );
}
}
public int getFlightConfigurationCount() {
checkState();
return this.configSet.size();
@ -363,7 +350,7 @@ public class Rocket extends RocketComponent {
this.functionalModID = r.functionalModID;
this.refType = r.refType;
this.customReferenceLength = r.customReferenceLength;
Rocket.cloneConfigs( r, this);
this.configSet = new FlightConfigurableParameterSet<FlightConfiguration>( r.configSet );
this.perfectFinish = r.perfectFinish;