Commit 67d8cbd0 authored by Julian Zobel's avatar Julian Zobel
Browse files

Fixed a bug in the weighted transition strategy where nodes would most...

Fixed a bug in the weighted transition strategy where nodes would most probably just wait the minimum pause time (plus a little bit) and therefore the waiting times were not quite right (especially for big differences)
parent caafb212
......@@ -111,8 +111,12 @@ public class ModularMultiTypeMovementModel extends ModularMovementModel
.getComponentOrNull(Topology.class)
.getWorldDimensions().getY();
} else {
if(transitions.containsKey(ms)) transitions.get(ms).reachedAttractionPoint(ms);
else transition.reachedAttractionPoint(ms);
if(transitions.containsKey(ms)) {
transitions.get(ms).reachedAttractionPoint(ms);
}
else {
transition.reachedAttractionPoint(ms);
}
movementListeners.forEach(l -> l.onTransition(ms));
}
}
......
......@@ -125,7 +125,12 @@ public class WeightedTransitionStrategy implements ITransitionStrategy, EventHan
}
@Override
public void reachedAttractionPoint(SimLocationActuator ms) {
public void reachedAttractionPoint(SimLocationActuator ms) {
// JZ: Added this to prevent multiple calls while pausing
if (!this.assignments.containsKey(ms)) {
return;
}
this.lastAssignments.put(ms, this.assignments.remove(ms));
Event.scheduleWithDelay(getPauseTime(ms), this, ms, EVENT_PAUSE_ENDED);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment