Fix importing when motor name has delay
Could not import e.g. B6-0 motor, it needed to be B6 (delay '-0' removed)
This commit is contained in:
parent
66f7542bcc
commit
bd02f17f8f
@ -116,7 +116,7 @@ public abstract class AbstractMotorLoader implements MotorLoader {
|
||||
* @param designation the motor designation.
|
||||
* @return the designation with a possible delay removed.
|
||||
*/
|
||||
protected static String removeDelay(String designation) {
|
||||
public static String removeDelay(String designation) {
|
||||
if (designation.matches(".*-([0-9]+|[pP])$")) {
|
||||
designation = designation.substring(0, designation.lastIndexOf('-'));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package net.sf.openrocket.file.rasaero.importt;
|
||||
|
||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||
import net.sf.openrocket.database.motor.ThrustCurveMotorSet;
|
||||
import net.sf.openrocket.file.motor.AbstractMotorLoader;
|
||||
import net.sf.openrocket.motor.ThrustCurveMotor;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
@ -31,7 +32,7 @@ public abstract class RASAeroMotorsLoader {
|
||||
if (split.length != 2) {
|
||||
return null;
|
||||
}
|
||||
String motorName = split[0];
|
||||
String motorName = AbstractMotorLoader.removeDelay(split[0]);
|
||||
String manufacturer = split[1].replaceAll("^\\(|\\)$", ""); // Remove beginning and ending parenthesis
|
||||
for (ThrustCurveMotor motor : allMotors) {
|
||||
if (motorName.equals(motor.getDesignation()) && motor.getManufacturer().matches(manufacturer)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user