bugfixes, reimplemented train simulator
This commit is contained in:
@@ -66,6 +66,20 @@ public abstract class Bridge extends Tile {
|
||||
return super.load(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lockFor(Context context, boolean downgrade) {
|
||||
if (lockingTrain() == context.train()) return true;
|
||||
if (!super.lockFor(context, downgrade)) return false;
|
||||
return isSet(counterpart) ? counterpart.lockFor(context, downgrade) : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reserveFor(Context context) {
|
||||
if (reservingTrain() == context.train()) return true;
|
||||
if (!super.reserveFor(context)) return false;
|
||||
return isSet(counterpart) ? counterpart.reserveFor(context) : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setTrain(Train newTrain) {
|
||||
if (occupyingTrain() == newTrain) return true;
|
||||
|
||||
@@ -434,6 +434,10 @@ public abstract class Tile extends BaseClass implements Comparable<Tile> {
|
||||
plan.place(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Train reservingTrain() {
|
||||
return reservingTrain;
|
||||
}
|
||||
|
||||
public TreeSet<Route> routes() {
|
||||
return routes;
|
||||
|
||||
Reference in New Issue
Block a user