[Bugfix] Restored AUTOMATIC Ignition Event, et al.
Restored Automatic ignition Option - "bottom" core stage is the lowest centerline ('AFTER') - Parallel Stages are always considered as 'launch' stages... and thus ignite on launch. Motors now copy Ignition parameters when loaded into a rocket. Added additional error checking in FlightConfigurationID - class is now tolerant of random string initializations
This commit is contained in:
parent
6af57134aa
commit
e7fbec3d89
@ -23,7 +23,6 @@ class IgnitionConfigurationHandler extends AbstractElementHandler {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElementHandler openElement(String element, HashMap<String, String> attributes,
|
public ElementHandler openElement(String element, HashMap<String, String> attributes,
|
||||||
WarningSet warnings) {
|
WarningSet warnings) {
|
||||||
@ -37,10 +36,6 @@ class IgnitionConfigurationHandler extends AbstractElementHandler {
|
|||||||
content = content.trim();
|
content = content.trim();
|
||||||
|
|
||||||
if (element.equals("ignitionevent")) {
|
if (element.equals("ignitionevent")) {
|
||||||
if ( content.equals( "automatic")){
|
|
||||||
content = "launch";
|
|
||||||
warnings.add( Warning.fromString("'automatic' separation is deprecated and has been converted to the 'launch' setting."));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IgnitionEvent ie : IgnitionEvent.values()) {
|
for (IgnitionEvent ie : IgnitionEvent.values()) {
|
||||||
if (ie.equals(content)) {
|
if (ie.equals(content)) {
|
||||||
|
@ -77,6 +77,12 @@ class MotorMountHandler extends AbstractElementHandler {
|
|||||||
RocketComponent mountComponent = (RocketComponent)mount;
|
RocketComponent mountComponent = (RocketComponent)mount;
|
||||||
motorInstance.setID( new MotorInstanceId(mountComponent.getID(), 1));
|
motorInstance.setID( new MotorInstanceId(mountComponent.getID(), 1));
|
||||||
motorInstance.setEjectionDelay(motorHandler.getDelay(warnings));
|
motorInstance.setEjectionDelay(motorHandler.getDelay(warnings));
|
||||||
|
|
||||||
|
// pull event data from defaults
|
||||||
|
MotorInstance defInstance = mount.getDefaultMotorInstance();
|
||||||
|
motorInstance.setIgnitionEvent( defInstance.getIgnitionEvent());
|
||||||
|
motorInstance.setIgnitionDelay( defInstance.getIgnitionDelay());
|
||||||
|
|
||||||
mount.setMotorInstance(fcid, motorInstance);
|
mount.setMotorInstance(fcid, motorInstance);
|
||||||
|
|
||||||
Rocket rkt = ((RocketComponent)mount).getRocket();
|
Rocket rkt = ((RocketComponent)mount).getRocket();
|
||||||
|
@ -117,6 +117,10 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC
|
|||||||
public boolean isAfter(){
|
public boolean isAfter(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLaunchStage(){
|
||||||
|
return ( getRocket().getBottomCoreStage().equals(this));
|
||||||
|
}
|
||||||
|
|
||||||
public void setStageNumber(final int newStageNumber) {
|
public void setStageNumber(final int newStageNumber) {
|
||||||
this.stageNumber = newStageNumber;
|
this.stageNumber = newStageNumber;
|
||||||
|
@ -23,11 +23,17 @@ public final class FlightConfigurationID implements Comparable<FlightConfigurati
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FlightConfigurationID(final String _str) {
|
public FlightConfigurationID(final String _str) {
|
||||||
|
UUID candidate;
|
||||||
if("".equals(_str)){
|
if("".equals(_str)){
|
||||||
this.key = UUID.randomUUID();
|
candidate = UUID.randomUUID();
|
||||||
}else{
|
}else{
|
||||||
this.key = UUID.fromString( _str);
|
try{
|
||||||
|
candidate = UUID.fromString( _str);
|
||||||
|
}catch( IllegalArgumentException iae ){
|
||||||
|
candidate = new UUID( 0, _str.hashCode() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.key = candidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlightConfigurationID(final UUID _val) {
|
public FlightConfigurationID(final UUID _val) {
|
||||||
|
@ -8,24 +8,19 @@ import net.sf.openrocket.startup.Application;
|
|||||||
|
|
||||||
public enum IgnitionEvent {
|
public enum IgnitionEvent {
|
||||||
|
|
||||||
// //// Automatic (launch or ejection charge)
|
//// Automatic (launch or ejection charge)
|
||||||
// AUTOMATIC( "AUTOMATIC", "MotorMount.IgnitionEvent.AUTOMATIC"){
|
AUTOMATIC( "AUTOMATIC", "MotorMount.IgnitionEvent.AUTOMATIC"){
|
||||||
// @Override
|
@Override
|
||||||
// public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
|
public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
|
||||||
// int count = source.getRocket().getStageCount();
|
AxialStage stage = (AxialStage)source;
|
||||||
// AxialStage stage = (AxialStage)source;
|
|
||||||
//
|
if ( stage.isLaunchStage() ){
|
||||||
// if ( stage instanceof ParallelStage ){
|
return LAUNCH.isActivationEvent(e, source);
|
||||||
// return LAUNCH.isActivationEvent(e, source);
|
} else {
|
||||||
// }else if (????){
|
return EJECTION_CHARGE.isActivationEvent(e, source);
|
||||||
// // no good option here. The non-sequential nature of
|
}
|
||||||
// // parallel stages prevents us from using the simple test as previousyl
|
}
|
||||||
// return LAUNCH.isActivationEvent(e, source);
|
},
|
||||||
// } else {
|
|
||||||
// return EJECTION_CHARGE.isActivationEvent(e, source);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
LAUNCH ( "LAUNCH", "MotorMount.IgnitionEvent.LAUNCH"){
|
LAUNCH ( "LAUNCH", "MotorMount.IgnitionEvent.LAUNCH"){
|
||||||
@Override
|
@Override
|
||||||
public boolean isActivationEvent( FlightEvent fe, RocketComponent source){
|
public boolean isActivationEvent( FlightEvent fe, RocketComponent source){
|
||||||
|
@ -105,6 +105,11 @@ public class ParallelStage extends AxialStage implements FlightConfigurableCompo
|
|||||||
public boolean isAfter(){
|
public boolean isAfter(){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLaunchStage(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInstanceCount( final int newCount ){
|
public void setInstanceCount( final int newCount ){
|
||||||
|
@ -204,7 +204,8 @@ public class Rocket extends RocketComponent {
|
|||||||
* @Return a reference to the topmost stage
|
* @Return a reference to the topmost stage
|
||||||
*/
|
*/
|
||||||
public AxialStage getBottomCoreStage(){
|
public AxialStage getBottomCoreStage(){
|
||||||
return (AxialStage) getChild(0);
|
// get last stage that's a direct child of the rocket.
|
||||||
|
return (AxialStage) children.get( children.size()-1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getNewStageNumber() {
|
private int getNewStageNumber() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user