bugfixes
This commit is contained in:
@@ -9,5 +9,6 @@
|
||||
|
||||
<root level="debug">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<logger name="de.srsoftware.web4rail.ControlUnit" level="WARN"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -39,6 +39,7 @@ public class ControlUnit extends Thread implements Constants{
|
||||
private static final String MODE_INFO = "INFO";
|
||||
private static final String MODE_COMMAND = "COMMAND";
|
||||
protected static final String FEEDBACK = "FB";
|
||||
protected static final String ACESSORY = "GA";
|
||||
|
||||
private String host = DEFAULT_HOST;
|
||||
private int port = DEFAULT_PORT;
|
||||
@@ -315,6 +316,7 @@ public class ControlUnit extends Thread implements Constants{
|
||||
int addr = Integer.parseInt(parts[5]);
|
||||
boolean active = !parts[6].equals("0");
|
||||
ControlUnit.this.plan.sensor(addr,active);
|
||||
case ACESSORY:
|
||||
break;
|
||||
default:
|
||||
LOG.debug("Info thread received: {}",line);
|
||||
|
||||
@@ -575,7 +575,12 @@ public class Plan extends BaseClass{
|
||||
* @return
|
||||
*/
|
||||
Route registerRoute(Route newRoute) {
|
||||
for (Tile tile: newRoute.path()) tile.add(newRoute);
|
||||
for (Tile tile: newRoute.path()) {
|
||||
if (isNull(tile)) {
|
||||
System.err.println("--");
|
||||
}
|
||||
tile.add(newRoute);
|
||||
}
|
||||
int routeId = newRoute.id();
|
||||
Route existingRoute = routes.get(routeId);
|
||||
if (isSet(existingRoute)) newRoute.addPropertiesFrom(existingRoute);
|
||||
|
||||
@@ -461,11 +461,15 @@ public class Route extends BaseClass{
|
||||
|
||||
private Route load(JSONObject json,Plan plan) {
|
||||
if (json.has(ID)) id = json.getInt(ID);
|
||||
if (json.has(NAME)) name(json.getString(NAME));
|
||||
JSONArray pathIds = json.getJSONArray(PATH);
|
||||
startDirection = Direction.valueOf(json.getString(START_DIRECTION));
|
||||
endDirection = Direction.valueOf(json.getString(END_DIRECTION));
|
||||
for (Object tileId : pathIds) {
|
||||
Tile tile = plan.get((String) tileId,false);
|
||||
if (isNull(tile)) {
|
||||
continue;
|
||||
}
|
||||
if (isNull(startBlock)) {
|
||||
begin((Block) tile, startDirection);
|
||||
} else if (tile instanceof Block) { // make sure, endDirection is set on last block
|
||||
@@ -474,7 +478,10 @@ public class Route extends BaseClass{
|
||||
add(tile, null);
|
||||
}
|
||||
}
|
||||
if (json.has(NAME)) name(json.getString(NAME));
|
||||
if (isNull(path) || path.isEmpty()) {
|
||||
LOG.warn("{} has no tiles. It will be ignored.",this);
|
||||
return null;
|
||||
}
|
||||
if (json.has(TURNOUTS)) {
|
||||
JSONArray turnouts = json.getJSONArray(TURNOUTS);
|
||||
for (int i=0; i<turnouts.length();i++) {
|
||||
|
||||
@@ -534,7 +534,12 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
}
|
||||
|
||||
private void reverseTrace() {
|
||||
// TODO Auto-generated method stub
|
||||
LinkedList<Tile> reversed = new LinkedList<Tile>();
|
||||
LOG.debug("Trace: {}",trace);
|
||||
while (!trace.isEmpty()) reversed.addFirst(trace.removeFirst());
|
||||
trace = reversed;
|
||||
LOG.debug("reversed: {}",trace);
|
||||
reversed = null;
|
||||
}
|
||||
|
||||
public static void saveAll(String filename) throws IOException {
|
||||
|
||||
@@ -11,8 +11,7 @@ public class Checkbox extends Tag {
|
||||
Tag checkbox = new Tag("input").attr("type", "checkbox").attr("name", name);
|
||||
if (preCheck) checkbox.attr("checked", "checked");
|
||||
checkbox.addTo(this);
|
||||
content(label);
|
||||
|
||||
content(label);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user