diff --git a/doomsday/client/include/world/segment.h b/doomsday/client/include/world/segment.h index 2c63f6d42c..c174a636f5 100644 --- a/doomsday/client/include/world/segment.h +++ b/doomsday/client/include/world/segment.h @@ -123,6 +123,8 @@ class Segment : public de::MapElement */ inline Line &line() const { return lineSide().line(); } +#ifdef __CLIENT__ + /** * Returns the distance along the attributed map line at which the from vertex * vertex occurs. If the segment is not attributed to a map line then @c 0 is @@ -144,8 +146,6 @@ class Segment : public de::MapElement /// @todo Refactor away. void setLength(coord_t newLength); -#ifdef __CLIENT__ - /** * Returns the current value of the flags of the line segment. */ diff --git a/doomsday/client/src/world/bsp/convexsubspace.cpp b/doomsday/client/src/world/bsp/convexsubspace.cpp index a067f88480..9beac898ae 100644 --- a/doomsday/client/src/world/bsp/convexsubspace.cpp +++ b/doomsday/client/src/world/bsp/convexsubspace.cpp @@ -436,9 +436,11 @@ void ConvexSubspace::buildGeometry(BspLeaf &leaf, Mesh &mesh) const // Attribute the segment to half-edge. hedge->setMapElement(seg); +#ifdef __CLIENT__ seg->setLineSideOffset(Vector2d(mapSide->from().origin() - lineSeg->from().origin()).length()); seg->setLength(Vector2d(lineSeg->to().origin() - lineSeg->from().origin()).length()); +#endif } // Link the new half-edge for this line segment to the head of @@ -530,9 +532,11 @@ void ConvexSubspace::buildGeometry(BspLeaf &leaf, Mesh &mesh) const // Attribute the segment to the half-edge. hedge->setMapElement(seg); +#ifdef __CLIENT__ seg->setLineSideOffset(Vector2d(mapSide->from().origin() - lineSeg->from().origin()).length()); seg->setLength(Vector2d(lineSeg->to().origin() - lineSeg->from().origin()).length()); +#endif } // Link the new half-edge for this line segment to the head of diff --git a/doomsday/client/src/world/map.cpp b/doomsday/client/src/world/map.cpp index 7fbd073297..49d52f57ec 100644 --- a/doomsday/client/src/world/map.cpp +++ b/doomsday/client/src/world/map.cpp @@ -3523,9 +3523,11 @@ bool Map::endEditing() hedge->twin().setTwin(hedge); // Polyobj has ownership of the line segments. - Segment *segment = new Segment(line->front(), *hedge); + new Segment(line->front(), *hedge); - segment->setLength(line->length()); +#ifdef __CLIENT__ + hedge->mapElement()->as()->setLength(line->length()); +#endif line->front().setLeftHEdge(hedge); line->front().setRightHEdge(hedge); diff --git a/doomsday/client/src/world/segment.cpp b/doomsday/client/src/world/segment.cpp index e03de3eff8..88d17ed59c 100644 --- a/doomsday/client/src/world/segment.cpp +++ b/doomsday/client/src/world/segment.cpp @@ -19,15 +19,9 @@ */ #include -#include -#include - -#include "dd_main.h" // App_World() -#include "BspLeaf" #include "HEdge" #include "Line" -#include "Sector" #ifdef __CLIENT__ # include "world/map.h" @@ -56,16 +50,16 @@ typedef QMap GeometryGroups; DENG2_PIMPL(Segment) { - /// Distance along the attributed map line at which the half-edge vertex occurs. - coord_t lineSideOffset; - /// Half-edge attributed to the line segment (not owned). HEdge *hedge; +#ifdef __CLIENT__ + /// Distance along the attributed map line at which the half-edge vertex occurs. + coord_t lineSideOffset; + /// Accurate length of the segment. coord_t length; -#ifdef __CLIENT__ /// Bias lighting data for each geometry group (i.e., each Line::Side section). GeometryGroups geomGroups; Flags flags; @@ -73,11 +67,11 @@ DENG2_PIMPL(Segment) Instance(Public *i, HEdge *hedge) : Base(i), - lineSideOffset(0), - hedge(hedge), - length(0) + hedge(hedge) #ifdef __CLIENT__ - ,flags(0) + ,lineSideOffset(0), + length(0), + flags(0) #endif {} @@ -189,6 +183,8 @@ Line::Side &Segment::lineSide() const return *this->parent().as(); } +#ifdef __CLIENT__ + coord_t Segment::lineSideOffset() const { return d->lineSideOffset; @@ -209,8 +205,6 @@ void Segment::setLength(coord_t newLength) d->length = newLength; } -#ifdef __CLIENT__ - Segment::Flags Segment::flags() const { return d->flags;