bugfixes
This commit is contained in:
@@ -38,11 +38,11 @@ public class PathFinder extends BaseClass{
|
|||||||
|
|
||||||
Block destination = train.destination();
|
Block destination = train.destination();
|
||||||
Direction direction = context.direction;
|
Direction direction = context.direction;
|
||||||
if (isSet(direction)) {
|
/* if (isSet(direction)) {
|
||||||
LOG.debug("{}Looking for {}-bound routes from {}",inset,direction,block);
|
LOG.debug("{}Looking for {}-bound routes from {}",inset,direction,block);
|
||||||
} else {
|
} else {
|
||||||
LOG.debug("{}Looking for all routes from {}",inset,block);
|
LOG.debug("{}Looking for all routes from {}",inset,block);
|
||||||
}
|
}*/
|
||||||
if (isSet(destination) && visitedRoutes.isEmpty()) LOG.debug("{}- Destination: {}",inset,destination);
|
if (isSet(destination) && visitedRoutes.isEmpty()) LOG.debug("{}- Destination: {}",inset,destination);
|
||||||
|
|
||||||
Route currentRoute = context.route;
|
Route currentRoute = context.route;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class Range extends BaseClass{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int random() {
|
public int random() {
|
||||||
|
if (max - min == 0) return max - min;
|
||||||
return min + random.nextInt(max - min);
|
return min + random.nextInt(max - min);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -172,14 +172,14 @@ public class Route extends BaseClass{
|
|||||||
Tag list = new Tag("ul");
|
Tag list = new Tag("ul");
|
||||||
for (Condition condition : conditions) {
|
for (Condition condition : conditions) {
|
||||||
Tag li = new Tag("li");
|
Tag li = new Tag("li");
|
||||||
link("span",Map.of(REALM,REALM_CONDITION,ID,id,ACTION,ACTION_PROPS,CONTEXT,REALM_ROUTE+":"+id),condition).addTo(li);
|
link("span",Map.of(REALM,REALM_CONDITION,ID,condition.id(),ACTION,ACTION_PROPS,CONTEXT,REALM_ROUTE+":"+id),condition).addTo(li);
|
||||||
Map<String, Object> params = Map.of(REALM,REALM_ROUTE,ID,id(),ACTION,DROP_CONDITION,REALM_CONDITION,condition.id());
|
Map<String, Object> params = Map.of(REALM,REALM_ROUTE,ID,id(),ACTION,DROP_CONDITION,REALM_CONDITION,condition.id());
|
||||||
new Button(t("delete"), params).addTo(li.content(NBSP)).addTo(list);
|
new Button(t("delete"), params).addTo(li.content(NBSP)).addTo(list);
|
||||||
}
|
}
|
||||||
list.addTo(win);
|
list.addTo(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
new Tag("div").content(t("Route will only be available to trains fulfilling all conditions.")).addTo(win);
|
new Tag("div").content(t("Route will only be available, if all conditions are fulfilled.")).addTo(win);
|
||||||
Form form = new Form("action-prop-form-"+id);
|
Form form = new Form("action-prop-form-"+id);
|
||||||
Fieldset fieldset = new Fieldset(t("Add condition"));
|
Fieldset fieldset = new Fieldset(t("Add condition"));
|
||||||
new Input(REALM,REALM_ROUTE).hideIn(form);
|
new Input(REALM,REALM_ROUTE).hideIn(form);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class TrainSelect extends Condition {
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (train == null) return t("[Click here to select train!]");
|
if (train == null) return t("[Click here to select train!]");
|
||||||
return t(inverted?"Train ≠ {}":"Train = {}",train);
|
return t("Train")+ (inverted?"≠":"=") + train;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TrainSelect train(Train train) {
|
private TrainSelect train(Train train) {
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
stop = false;
|
stop = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (isNull(route)) {
|
if (isNull(route)) {
|
||||||
LOG.debug("Waiting {} secs...",waitTime/1000d);
|
|
||||||
Thread.sleep(waitTime);
|
Thread.sleep(waitTime);
|
||||||
if (waitTime > 100) waitTime /=2;
|
if (waitTime > 100) waitTime /=2;
|
||||||
if (stop) return;
|
if (stop) return;
|
||||||
@@ -587,6 +586,8 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
|
|
||||||
public void setWaitTime(Range waitTime) {
|
public void setWaitTime(Range waitTime) {
|
||||||
if (autopilot != null) autopilot.waitTime = waitTime.random();
|
if (autopilot != null) autopilot.waitTime = waitTime.random();
|
||||||
|
LOG.debug("{} waiting {} secs...",this,autopilot.waitTime/1000d);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showTrace() {
|
public void showTrace() {
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class Contact extends Tile{
|
|||||||
public Form propForm(String formId) {
|
public Form propForm(String formId) {
|
||||||
Form form = super.propForm(formId);
|
Form form = super.propForm(formId);
|
||||||
new Tag("h4").content(t("Hardware settings")).addTo(form);
|
new Tag("h4").content(t("Hardware settings")).addTo(form);
|
||||||
Tag label = new Input(ADDRESS, addr).addTo(new Label(t("Address:")+NBSP));
|
Tag label = new Input(ADDRESS, addr).numeric().addTo(new Label(t("Address:")+NBSP));
|
||||||
Map<String, String> props = Map.of(REALM,REALM_CONTACT,ID,id(),ACTION,ACTION_ANALYZE);
|
Map<String, String> props = Map.of(REALM,REALM_CONTACT,ID,id(),ACTION,ACTION_ANALYZE);
|
||||||
new Button(t("learn"), props).addTo(label).addTo(form);
|
new Button(t("learn"), props).addTo(label).addTo(form);
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public abstract class Tile extends BaseClass{
|
|||||||
public boolean isFreeFor(Train newTrain) {
|
public boolean isFreeFor(Train newTrain) {
|
||||||
if (disabled) return false;
|
if (disabled) return false;
|
||||||
if (isSet(route)) return false;
|
if (isSet(route)) return false;
|
||||||
if (isSet(train) && newTrain != train) return false;
|
if (isSet(train) && train != newTrain) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user