implemented adding of locos to train
This commit is contained in:
@@ -105,11 +105,11 @@ public abstract class Block extends StretchableTile{
|
||||
return getClass().getSimpleName()+"("+name+") @ ("+x+","+y+")";
|
||||
}
|
||||
|
||||
public void train(Train newTrain) throws IOException {
|
||||
if (train == newTrain) return;
|
||||
public Tile train(Train newTrain) throws IOException {
|
||||
if (train == newTrain) return this;
|
||||
if (train != null) train.block(null); // vorherigen Zug rauswerfen
|
||||
if (newTrain != null) newTrain.block(this);
|
||||
super.train(newTrain);
|
||||
return super.train(newTrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -341,9 +341,9 @@ public abstract class Tile implements Constants{
|
||||
return train;
|
||||
}
|
||||
|
||||
public void train(Train train) throws IOException {
|
||||
public Tile train(Train train) throws IOException {
|
||||
this.train = train;
|
||||
plan.place(this);
|
||||
return plan.place(this);
|
||||
}
|
||||
|
||||
public void unlock() throws IOException {
|
||||
|
||||
@@ -153,7 +153,7 @@ public abstract class Turnout extends Tile implements Device{
|
||||
@Override
|
||||
protected void onFailure(Reply reply) {
|
||||
super.onFailure(reply);
|
||||
plan.stream(t("Unable to switch {}: {}",this,reply.message()));
|
||||
plan.stream(t("Unable to switch \"{}\": {}",Turnout.this,reply.message()));
|
||||
}
|
||||
|
||||
}).reply();
|
||||
|
||||
Reference in New Issue
Block a user