Skip to content

Commit

Permalink
addendum refs #14886
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed May 18, 2024
1 parent 807036e commit 699b294
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/microsim/transportables/MSTransportable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ MSTransportable::removeStage(int next, bool stayInSim) {
(*myStep)->abort(this);
if (!proceed(MSNet::getInstance(), SIMSTEP)) {
MSNet::getInstance()->getPersonControl().erase(this);
} else if (myPlan->front()->getDeparted() < 0) {
myPlan->front()->setDeparted(SIMSTEP);
}
}
}
Expand Down Expand Up @@ -587,7 +589,13 @@ void
MSTransportable::saveState(OutputDevice& out) {
// this saves lots of departParameters which are only needed for transportables that did not yet depart
// the parameters may hold the name of a vTypeDistribution but we are interested in the actual type
const SUMOTime desiredDepart = myParameter->depart;
if (myPlan->front()->getDeparted() >= 0) {
// this is only relevant in the context of delayed departure (max-num-persons)
const_cast<SUMOVehicleParameter*>(myParameter)->depart = myPlan->front()->getDeparted();
}
myParameter->write(out, OptionsCont::getOptions(), myAmPerson ? SUMO_TAG_PERSON : SUMO_TAG_CONTAINER, getVehicleType().getID());
const_cast<SUMOVehicleParameter*>(myParameter)->depart = desiredDepart;
if (!myParameter->wasSet(VEHPARS_SPEEDFACTOR_SET) && getChosenSpeedFactor() != 1) {
out.setPrecision(MAX2(gPrecisionRandom, gPrecision));
out.writeAttr(SUMO_ATTR_SPEEDFACTOR, getChosenSpeedFactor());
Expand Down Expand Up @@ -618,6 +626,7 @@ MSTransportable::loadState(const std::string& state) {
std::istringstream iss(state);
int step;
iss >> myParameter->parametersSet >> step;
myPlan->front()->setDeparted(myParameter->depart);
myStep = myPlan->begin() + step;
(*myStep)->loadState(this, iss);
}
Expand Down

0 comments on commit 699b294

Please sign in to comment.