bugfixes
This commit is contained in:
@@ -38,11 +38,11 @@ public class PathFinder extends BaseClass{
|
||||
|
||||
Block destination = train.destination();
|
||||
Direction direction = context.direction;
|
||||
if (isSet(direction)) {
|
||||
/* if (isSet(direction)) {
|
||||
LOG.debug("{}Looking for {}-bound routes from {}",inset,direction,block);
|
||||
} else {
|
||||
LOG.debug("{}Looking for all routes from {}",inset,block);
|
||||
}
|
||||
}*/
|
||||
if (isSet(destination) && visitedRoutes.isEmpty()) LOG.debug("{}- Destination: {}",inset,destination);
|
||||
|
||||
Route currentRoute = context.route;
|
||||
|
||||
@@ -25,6 +25,7 @@ public class Range extends BaseClass{
|
||||
}
|
||||
|
||||
public int random() {
|
||||
if (max - min == 0) return max - min;
|
||||
return min + random.nextInt(max - min);
|
||||
}
|
||||
|
||||
|
||||
@@ -172,14 +172,14 @@ public class Route extends BaseClass{
|
||||
Tag list = new Tag("ul");
|
||||
for (Condition condition : conditions) {
|
||||
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());
|
||||
new Button(t("delete"), params).addTo(li.content(NBSP)).addTo(list);
|
||||
}
|
||||
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);
|
||||
Fieldset fieldset = new Fieldset(t("Add condition"));
|
||||
new Input(REALM,REALM_ROUTE).hideIn(form);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TrainSelect extends Condition {
|
||||
@Override
|
||||
public String toString() {
|
||||
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) {
|
||||
|
||||
@@ -89,7 +89,6 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
stop = false;
|
||||
while (true) {
|
||||
if (isNull(route)) {
|
||||
LOG.debug("Waiting {} secs...",waitTime/1000d);
|
||||
Thread.sleep(waitTime);
|
||||
if (waitTime > 100) waitTime /=2;
|
||||
if (stop) return;
|
||||
@@ -587,6 +586,8 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
|
||||
public void setWaitTime(Range waitTime) {
|
||||
if (autopilot != null) autopilot.waitTime = waitTime.random();
|
||||
LOG.debug("{} waiting {} secs...",this,autopilot.waitTime/1000d);
|
||||
|
||||
}
|
||||
|
||||
public void showTrace() {
|
||||
|
||||
@@ -117,7 +117,7 @@ public class Contact extends Tile{
|
||||
public Form propForm(String formId) {
|
||||
Form form = super.propForm(formId);
|
||||
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);
|
||||
new Button(t("learn"), props).addTo(label).addTo(form);
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public abstract class Tile extends BaseClass{
|
||||
public boolean isFreeFor(Train newTrain) {
|
||||
if (disabled) return false;
|
||||
if (isSet(route)) return false;
|
||||
if (isSet(train) && newTrain != train) return false;
|
||||
if (isSet(train) && train != newTrain) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user