bugfix: implemented delayed loading of contact data in TriggerdContact
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>de.srsoftware</groupId>
|
<groupId>de.srsoftware</groupId>
|
||||||
<artifactId>web4rail</artifactId>
|
<artifactId>web4rail</artifactId>
|
||||||
<version>1.5.10</version>
|
<version>1.5.11</version>
|
||||||
<name>Web4Rail</name>
|
<name>Web4Rail</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>Java Model Railway Control</description>
|
<description>Java Model Railway Control</description>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.Map;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import de.srsoftware.web4rail.BaseClass;
|
import de.srsoftware.web4rail.BaseClass;
|
||||||
|
import de.srsoftware.web4rail.LoadCallback;
|
||||||
import de.srsoftware.web4rail.Params;
|
import de.srsoftware.web4rail.Params;
|
||||||
import de.srsoftware.web4rail.tags.Fieldset;
|
import de.srsoftware.web4rail.tags.Fieldset;
|
||||||
import de.srsoftware.web4rail.tags.Window;
|
import de.srsoftware.web4rail.tags.Window;
|
||||||
@@ -42,7 +43,14 @@ public class TriggerContact extends Action {
|
|||||||
public Action load(JSONObject json) {
|
public Action load(JSONObject json) {
|
||||||
super.load(json);
|
super.load(json);
|
||||||
Id contactId = Id.from(json,CONTACT);
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1171,7 +1171,9 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
} else { // behind train
|
} else { // behind train
|
||||||
if (Route.freeBehindTrain) {
|
if (Route.freeBehindTrain) {
|
||||||
LOG.debug("{} is behind train and will be freed in the next step",tile);
|
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 {
|
} else {
|
||||||
LOG.debug("{} is behind train and will be reset to \"locked\" state",tile);
|
LOG.debug("{} is behind train and will be reset to \"locked\" state",tile);
|
||||||
tile.lockFor(context,true);
|
tile.lockFor(context,true);
|
||||||
|
|||||||
Reference in New Issue
Block a user