improved actions and conditions code,
added TrainLength condition, added FreeStartBlock action
This commit is contained in:
@@ -151,19 +151,6 @@ public class Train implements Constants {
|
||||
} else cars.add(car);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static Object create(HashMap<String, String> params, Plan plan) {
|
||||
Locomotive loco = (Locomotive) Locomotive.get(params.get(Train.LOCO_ID));
|
||||
if (loco == null) return t("unknown locomotive: {}",params.get(ID));
|
||||
Train train = new Train(loco).plan(plan);
|
||||
if (params.containsKey(NAME)) train.name(params.get(NAME));
|
||||
return train;
|
||||
}
|
||||
|
||||
private Train name(String newName) {
|
||||
this.name = newName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void add(Car car) {
|
||||
if (car == null) return;
|
||||
@@ -189,6 +176,14 @@ public class Train implements Constants {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
private static Object create(HashMap<String, String> params, Plan plan) {
|
||||
Locomotive loco = (Locomotive) Locomotive.get(params.get(Train.LOCO_ID));
|
||||
if (loco == null) return t("unknown locomotive: {}",params.get(ID));
|
||||
Train train = new Train(loco).plan(plan);
|
||||
if (params.containsKey(NAME)) train.name(params.get(NAME));
|
||||
return train;
|
||||
}
|
||||
|
||||
public static Train get(int id) {
|
||||
return trains.get(id);
|
||||
}
|
||||
@@ -321,6 +316,11 @@ public class Train implements Constants {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Train name(String newName) {
|
||||
this.name = newName;
|
||||
return this;
|
||||
}
|
||||
|
||||
private Train plan(Plan plan) {
|
||||
this.plan = plan;
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user