if(json.has(BLOCK))currentBlock=(Block)plan.get(newId(json.getString(BLOCK)),false).setTrain(this);// do not move this up! during set, other fields will be referenced!
if(routeCandidate.endBlock()!=destination){// allowance may be overridden by destination
LOG.debug("{} not allowed for {}",routeCandidate,context);
LOG.debug("{} not allowed for {}",routeCandidate,c);
continue;// Zug darf auf Grund einer nicht erfüllten Bedingung nicht auf die Route
}
LOG.debug("{} not allowed for {} – overridden by selected destination",routeCandidate,context);
LOG.debug("{} not allowed for {} – overridden by selected destination",routeCandidate,c);
}
intpriority=0;
if(isSet(direction)&&routeCandidate.startDirection!=direction){// Route startet entgegen der aktuellen Fahrtrichtung des Zuges
if(isSet(startDir)&&routeCandidate.startDirection!=startDir){// Route startet entgegen der aktuellen Fahrtrichtung des Zuges
if(!train.pushPull)continue;// Zug kann nicht wenden
if(!block.turnAllowed)continue;// Wenden im Block nicht gestattet
if(!start.turnAllowed)continue;// Wenden im Block nicht gestattet
priority-=5;
}
if(routeCandidate==currentRoute)priority-=10; // möglichst andere Route als zuvor wählen // TODO: den Routen einen "last-used" Zeitstempel hinzufügen, und diesen mit in die Priorisierung einbeziehen
//if (routeCandidate == currentRoute) priority-=10; // möglichst andere Route als zuvor wählen // TODO: den Routen einen "last-used" Zeitstempel hinzufügen, und diesen mit in die Priorisierung einbeziehen
if(isSet(destination)){
if(routeCandidate.endBlock()==destination){// route goes directly to destination
@ -90,9 +95,8 @@ public abstract class PathFinder extends BaseClass implements Runnable{
@@ -90,9 +95,8 @@ public abstract class PathFinder extends BaseClass implements Runnable{
if(newTrain==train){// during train.reserveNext, we may encounter, parts, that are already reserved by the respective train, but having another route. do not compare routes in that case!
PathFinder.LOG.debug("already reserved by {} → true",train);
returntrue;
}
if(isSet(newTrain)&&newTrain.isShunting()){
PathFinder.LOG.debug("occupied by {}. Allowed for shunting {}",train,newTrain);
returntrue;
}
PathFinder.LOG.debug("occupied by {} → false",train);
PathFinder.LOG.debug("{} is occupied by {}",this,train);
returnfalse;
}
if(isSet(route)){
PathFinder.LOG.debug("{} is occupied by {}",this,route);
returnfalse;
}
}
if(isSet(train)){
TraincontextTrain=context.train();
booleanfree=train==contextTrain;// during train.reserveNext, we may encounter, parts, that are already reserved by the respective train, but having another route. do not compare routes in that case!
if(free){
PathFinder.LOG.debug("already reserved by {} → true",train);