Sync sims modID after file import

This fixes loaded sims to still be marked as up-to-date after .ork importing
This commit is contained in:
SiboVG 2023-01-16 03:26:29 +01:00
parent 993cd3169a
commit 25f0984334
2 changed files with 9 additions and 1 deletions

View File

@ -340,6 +340,12 @@ public class Simulation implements ChangeSource, Cloneable {
return status == Status.UPTODATE || status == Status.LOADED || status == Status.EXTERNAL;
}
/**
* Syncs the modID with its flight configuration.
*/
public void syncModID() {
this.simulatedConfigurationID = getActiveConfiguration().getModID();
}
/**

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -62,6 +63,7 @@ public class OpenRocketLoader extends AbstractRocketLoader {
// Deduce suitable time skip
double timeSkip = StorageOptions.SIMULATION_DATA_NONE;
for (Simulation s : doc.getSimulations()) {
s.syncModID(); // The config's modID can be out of sync with the simulation's after the whole loading process
if (s.getStatus() == Simulation.Status.EXTERNAL ||
s.getStatus() == Simulation.Status.NOT_SIMULATED)
continue;