minor improvements

This commit is contained in:
Stephan Richter
2020-12-10 20:18:31 +01:00
parent 0855a943eb
commit 49185e79a2
5 changed files with 15 additions and 6 deletions

View File

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.srsoftware</groupId>
<artifactId>web4rail</artifactId>
<version>1.2.39</version>
<version>1.2.40</version>
<name>Web4Rail</name>
<packaging>jar</packaging>
<description>Java Model Railway Control</description>

View File

@@ -347,7 +347,7 @@ public class Route extends BaseClass {
add(lastContact.trigger(), new BrakeStop(this));
add(lastContact.trigger(), new FinishRoute(this));
}
for (Signal signal : signals) add(ROUTE_SETUP,new SetSignal(this).set(signal).to(Signal.GO));
for (Signal signal : signals) add(ROUTE_START,new SetSignal(this).set(signal).to(Signal.GO));
add(ROUTE_START,new SetSpeed(this).to(999));
return this;
}
@@ -363,7 +363,7 @@ public class Route extends BaseClass {
LOG.debug("{} on {} activated {}.",train,this,contact);
traceTrainFrom(contact);
ActionList actions = triggeredActions.get(contact.trigger());
LOG.debug("Contact has id {} / trigger {} and is assigned with {}",contact.id(),contact.trigger(),actions);
LOG.debug("Contact has id {} / trigger {} and is assigned with {}",contact.id(),contact.trigger(),isNull(actions)?t("nothing"):actions);
if (isNull(actions)) return;
context.contact(contact);
actions.fire(context);

View File

@@ -225,4 +225,9 @@ public class ActionList extends Action implements Iterable<Action>{
actions.remove(child);
super.removeChild(child);
}
@Override
public String toString() {
return actions.toString();
}
}

View File

@@ -78,12 +78,16 @@ public class Contact extends Tile{
Context context = null;
if (isSet(route)) {
context = route.context();
actions.fire(context);
route.contact(this);
} else if (getClass() != Contact.class) {
plan.warn(this);
}
if (isNull(context)) context = new Context(this);
actions.fire(context);
if (isNull(context)) {
context = new Context(this);
actions.fire(context);
}
stream();
}
}

View File

@@ -174,7 +174,7 @@ public class Relay extends Tile implements Device{
public Reply state(boolean newState) {
Reply reply = init();
if (reply != null && !reply.succeeded()) return reply;
LOG.debug("Setting {} to {}",this,newState);
LOG.debug("Setting {} to {}",this,newState?1:0);
try {
String cmd = commandFor(newState);
return plan.queue(new Command(cmd) {