Skip to content

Commit

Permalink
fix #1957
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Nov 27, 2018
1 parent 9195bdf commit ea74d86
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/gui/GUIApplicationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,16 @@ GUIApplicationWindow::handleEvent_SimulationLoaded(GUIEvent* e) {
myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
myRunThread->getBreakpointLock().unlock();
}
if (!OptionsCont::getOptions().isDefault("breakpoints")) {
std::vector<SUMOTime> breakpoints;
for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
breakpoints.push_back(string2time(val));
}
std::sort(breakpoints.begin(), breakpoints.end());
myRunThread->getBreakpointLock().lock();
myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
myRunThread->getBreakpointLock().unlock();
}
myJamSounds = settings.getEventDistribution("jam");
myCollisionSounds = settings.getEventDistribution("collision");
if (settings.getJamSoundTime() > 0) {
Expand Down
14 changes: 13 additions & 1 deletion src/microsim/MSFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@ MSFrame::fillOptions() {
oc.doRegister("start", 'S', new Option_Bool(false));
oc.addDescription("start", "GUI Only", "Start the simulation after loading");

oc.doRegister("breakpoints", new Option_String());
oc.addDescription("breakpoints", "Output", "Use TIME[] as times when the simulation should halt");

oc.doRegister("demo", 'D', new Option_Bool(false));
oc.addDescription("demo", "GUI Only", "Restart the simulation after ending (demo mode)");

Expand Down Expand Up @@ -627,6 +630,15 @@ MSFrame::checkOptions() {
}
}
}
for (const std::string& val : oc.getStringVector("breakpoints")) {
try {
string2time(val);
} catch (ProcessError& e) {
WRITE_ERROR("Invalid time '" + val + "' for option 'breakpoints'. Must be a FLOAT or human-readable time");
ok = false;
}
};

ok &= MSDevice::checkOptions(oc);
ok &= SystemFrame::checkOptions();

Expand Down Expand Up @@ -689,7 +701,7 @@ MSFrame::setMSGlobals(OptionsCont& oc) {
}

MSGlobals::gEmergencyDecelWarningThreshold = oc.getFloat("emergencydecel.warning-threshold");

#ifdef _DEBUG
if (oc.isSet("movereminder-output")) {
MSBaseVehicle::initMoveReminderOutput(oc);
Expand Down

0 comments on commit ea74d86

Please sign in to comment.