implemented handling of stuck trains during route search
This commit is contained in:
@@ -278,8 +278,9 @@ public abstract class Block extends StretchableTile{
|
||||
if (isNull(firstTrain)) return true;
|
||||
if (firstTrain != train) return false;
|
||||
trains.remove(train);
|
||||
status = trains.isEmpty() ? Status.FREE : Status.OCCUPIED;
|
||||
plan.place(this);
|
||||
if (isSet(firstTrain)) {
|
||||
super.free(train);
|
||||
} else super.setTrain(firstTrain);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public abstract class Tile extends BaseClass implements Comparable<Tile> {
|
||||
}
|
||||
|
||||
public boolean free(Train t) {
|
||||
if (t != train) return false;
|
||||
if (isSet(train) && t != train) return false;
|
||||
train = null;
|
||||
status = Status.FREE;
|
||||
plan.place(this);
|
||||
|
||||
Reference in New Issue
Block a user