diff --git a/src/tools/trackeditor/gui/EditorFrame.java b/src/tools/trackeditor/gui/EditorFrame.java index abbe2e6d5..375dd34bf 100644 --- a/src/tools/trackeditor/gui/EditorFrame.java +++ b/src/tools/trackeditor/gui/EditorFrame.java @@ -3016,4 +3016,9 @@ public class EditorFrame extends JFrame return 0; } + + public Segment getSegment(String name) + { + return trackData.getSegments().getSegment(name); + } } diff --git a/src/tools/trackeditor/plugin/torcs/XmlReader.java b/src/tools/trackeditor/plugin/torcs/XmlReader.java index 9c7068e79..9fcfba5c8 100644 --- a/src/tools/trackeditor/plugin/torcs/XmlReader.java +++ b/src/tools/trackeditor/plugin/torcs/XmlReader.java @@ -288,7 +288,8 @@ public class XmlReader cam.setComment(getAttrStrValue(camera, "comment")); cam.setSegment(getAttrStrValue(camera, "segment")); cam.setToRight(getAttrNumValue(camera, "to right")); - cam.setToStart(getAttrNumValue(camera, "to start", "deg")); + // units can be meters for straights or degrees for curves + cam.setToStart(getAttrNumValue(camera, "to start")); cam.setHeight(getAttrNumValue(camera, "height")); cam.setFovStart(getAttrStrValue(camera, "fov start")); cam.setFovEnd(getAttrStrValue(camera, "fov end")); diff --git a/src/tools/trackeditor/plugin/torcs/XmlWriter.java b/src/tools/trackeditor/plugin/torcs/XmlWriter.java index 1778bef7d..429511214 100644 --- a/src/tools/trackeditor/plugin/torcs/XmlWriter.java +++ b/src/tools/trackeditor/plugin/torcs/XmlWriter.java @@ -548,7 +548,16 @@ public class XmlWriter addContent(el, "comment", camera.getComment()); addContent(el, "segment", camera.getSegment()); addContent(el, "to right", null, camera.getToRight()); - addContent(el, "to start", "deg", camera.getToStart()); + // units can be meters for straights or degrees for curves + Segment segment = editorFrame.getSegment(camera.getSegment()); + if (segment != null && !segment.getType().equals("str")) + { + addContent(el, "to start", "deg", camera.getToStart()); + } + else + { + addContent(el, "to start", null, camera.getToStart()); + } addContent(el, "height", null, camera.getHeight()); addContent(el, "fov start", camera.getFovStart()); addContent(el, "fov end", camera.getFovEnd()); diff --git a/src/tools/trackeditor/utils/Properties.java b/src/tools/trackeditor/utils/Properties.java index 85b61574b..3110eb28c 100644 --- a/src/tools/trackeditor/utils/Properties.java +++ b/src/tools/trackeditor/utils/Properties.java @@ -34,7 +34,7 @@ public class Properties private static Properties instance = new Properties(); private Vector propertiesListeners = new Vector(); public final String title = "sd2-trackeditor"; - public final String version = "1.0.10"; + public final String version = "1.0.11"; private String path; private double imageScale = 1; diff --git a/src/tools/trackeditor/utils/SegmentVector.java b/src/tools/trackeditor/utils/SegmentVector.java index 9ec4fc611..a0e9dd5fc 100644 --- a/src/tools/trackeditor/utils/SegmentVector.java +++ b/src/tools/trackeditor/utils/SegmentVector.java @@ -195,4 +195,17 @@ public class SegmentVector extends Vector return valid; } + + public Segment getSegment(String name) + { + for (Segment segment : this) + { + if (segment.getName().equals(name)) + { + return segment; + } + } + return null; + } + }