Make SimulationOptions.copyFrom prefer matches based on exact match of
the configuration id.
This commit is contained in:
parent
4cc3485fa0
commit
ea3aeedf1b
@ -404,21 +404,26 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (src.rocket.hasMotors(src.motorID)) {
|
if (src.rocket.hasMotors(src.motorID)) {
|
||||||
// Try to find a closely matching motor ID
|
// First check for exact match:
|
||||||
MotorDescriptionSubstitutor formatter = Application.getInjector().getInstance(MotorDescriptionSubstitutor.class);
|
if (this.rocket.isFlightConfigurationID(src.motorID)) {
|
||||||
|
this.motorID = src.motorID;
|
||||||
String motorDesc = formatter.getMotorConfigurationDescription(src.rocket, src.motorID);
|
} else {
|
||||||
String matchID = null;
|
// Try to find a closely matching motor ID
|
||||||
|
MotorDescriptionSubstitutor formatter = Application.getInjector().getInstance(MotorDescriptionSubstitutor.class);
|
||||||
for (String id : this.rocket.getFlightConfigurationIDs()) {
|
|
||||||
String motorDesc2 = formatter.getMotorConfigurationDescription(this.rocket, id);
|
String motorDesc = formatter.getMotorConfigurationDescription(src.rocket, src.motorID);
|
||||||
if (motorDesc.equals(motorDesc2)) {
|
String matchID = null;
|
||||||
matchID = id;
|
|
||||||
break;
|
for (String id : this.rocket.getFlightConfigurationIDs()) {
|
||||||
|
String motorDesc2 = formatter.getMotorConfigurationDescription(this.rocket, id);
|
||||||
|
if (motorDesc.equals(motorDesc2)) {
|
||||||
|
matchID = id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.motorID = matchID;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.motorID = matchID;
|
|
||||||
} else {
|
} else {
|
||||||
this.motorID = null;
|
this.motorID = null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user