bugfix: implemented delayed loading of contact data in TriggerdContact

This commit is contained in:
Stephan Richter
2021-06-29 12:54:18 +02:00
parent ef4740ccda
commit f0d3ad094f
3 changed files with 13 additions and 3 deletions

View File

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

View File

@@ -6,6 +6,7 @@ import java.util.Map;
import org.json.JSONObject;
import de.srsoftware.web4rail.BaseClass;
import de.srsoftware.web4rail.LoadCallback;
import de.srsoftware.web4rail.Params;
import de.srsoftware.web4rail.tags.Fieldset;
import de.srsoftware.web4rail.tags.Window;
@@ -42,7 +43,14 @@ public class TriggerContact extends Action {
public Action load(JSONObject json) {
super.load(json);
Id contactId = Id.from(json,CONTACT);
if (isSet(contactId)) contact = Contact.get(contactId);
if (isSet(contactId)) new LoadCallback() {
@Override
public void afterLoad() {
contact = Contact.get(contactId);
}
};
return this;
}

View File

@@ -1171,7 +1171,9 @@ public class Train extends BaseClass implements Comparable<Train> {
} else { // behind train
if (Route.freeBehindTrain) {
LOG.debug("{} is behind train and will be freed in the next step",tile);
trace.add(tile); // old trace will be cleared afterwards
if (tile != route.endBlock()) { // if train is shorter than contact after endblock, the endblock would be cleared…
trace.add(tile); // old trace will be cleared afterwards
}
} else {
LOG.debug("{} is behind train and will be reset to \"locked\" state",tile);
tile.lockFor(context,true);