[refine] removed ~40% excess configuration clones while creating undo point.
This commit is contained in:
parent
1c326c88c3
commit
31938d69d7
@ -310,24 +310,11 @@ public class Rocket extends RocketComponent {
|
|||||||
// Rocket copy is cloned, so non-trivial members must be cloned as well:
|
// Rocket copy is cloned, so non-trivial members must be cloned as well:
|
||||||
copy.stageMap = new HashMap<Integer, AxialStage>();
|
copy.stageMap = new HashMap<Integer, AxialStage>();
|
||||||
copy.configSet = new FlightConfigurableParameterSet<FlightConfiguration>( this.configSet );
|
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>();
|
copy.listenerList = new ArrayList<EventListener>();
|
||||||
|
|
||||||
return copy;
|
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() {
|
public int getFlightConfigurationCount() {
|
||||||
checkState();
|
checkState();
|
||||||
return this.configSet.size();
|
return this.configSet.size();
|
||||||
@ -363,7 +350,7 @@ public class Rocket extends RocketComponent {
|
|||||||
this.functionalModID = r.functionalModID;
|
this.functionalModID = r.functionalModID;
|
||||||
this.refType = r.refType;
|
this.refType = r.refType;
|
||||||
this.customReferenceLength = r.customReferenceLength;
|
this.customReferenceLength = r.customReferenceLength;
|
||||||
Rocket.cloneConfigs( r, this);
|
this.configSet = new FlightConfigurableParameterSet<FlightConfiguration>( r.configSet );
|
||||||
|
|
||||||
this.perfectFinish = r.perfectFinish;
|
this.perfectFinish = r.perfectFinish;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user