diff --git a/src/map/IMG/rgnfile.cpp b/src/map/IMG/rgnfile.cpp index 5105542d..c0dc8ab6 100644 --- a/src/map/IMG/rgnfile.cpp +++ b/src/map/IMG/rgnfile.cpp @@ -125,7 +125,7 @@ bool RGNFile::polyObjects(Handle &hdl, const SubDiv *subdiv, if (!segment.isValid()) return true; - if (!seek(hdl, segment.start())) + if (!seek(hdl, segment.offset())) return false; quint32 labelPtr; @@ -203,7 +203,7 @@ bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift, if (!segment.isValid()) return true; - if (!seek(hdl, segment.start())) + if (!seek(hdl, segment.offset())) return false; while (hdl.pos < (int)segment.end()) { @@ -302,7 +302,7 @@ bool RGNFile::pointObjects(Handle &hdl, const SubDiv *subdiv, if (!segment.isValid()) return true; - if (!seek(hdl, segment.start())) + if (!seek(hdl, segment.offset())) return false; while (hdl.pos < (int)segment.end()) { @@ -348,7 +348,7 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv, LBLFile *lbl, if (!segment.isValid()) return true; - if (!seek(hdl, segment.start())) + if (!seek(hdl, segment.offset())) return false; while (hdl.pos < (int)segment.end()) { @@ -412,22 +412,19 @@ QMap RGNFile::segments(Handle &hdl, quint32 start = offset + 2 * (no - 1); quint32 ls = 0; SegmentType lt = (SegmentType)0; - quint16 po; - int cnt = 0; for (quint16 mask = 0x1; mask <= 0x10; mask <<= 1) { if (subdiv->objects() & mask) { - if (cnt) { + if (ls) { + quint16 po; if (!readUInt16(hdl, po) || !po) return QMap(); start = offset + po; - } - if (ls) ret.insert(lt, SubDiv::Segment(ls, start)); + } lt = (SegmentType)mask; ls = start; - cnt++; } } diff --git a/src/map/IMG/subdiv.h b/src/map/IMG/subdiv.h index b10cc038..5896d176 100644 --- a/src/map/IMG/subdiv.h +++ b/src/map/IMG/subdiv.h @@ -9,16 +9,16 @@ class SubDiv { public: class Segment { public: - Segment() : _start(0), _end(0) {} - Segment(quint32 start, quint32 end) : _start(start), _end(end) {} + Segment() : _offset(0), _end(0) {} + Segment(quint32 ofset, quint32 end) : _offset(ofset), _end(end) {} - bool isValid() const {return (_end > _start);} + bool isValid() const {return (_end > _offset);} - quint32 start() const {return _start;} + quint32 offset() const {return _offset;} quint32 end() const {return _end;} private: - quint32 _start, _end; + quint32 _offset, _end; }; SubDiv(quint32 offset, qint32 lon, qint32 lat, int bits, quint8 objects) @@ -54,21 +54,21 @@ public: const Segment &roadReferences, const Segment &extPoints, const Segment &extLines, const Segment &extPolygons) { - _rgn.pointsOffset = points.start(); + _rgn.pointsOffset = points.offset(); _rgn.pointsEnd = points.end(); - _rgn.idxPointsOffset = idxPoints.start(); + _rgn.idxPointsOffset = idxPoints.offset(); _rgn.idxPointsEnd = idxPoints.end(); - _rgn.linesOffset = lines.start(); + _rgn.linesOffset = lines.offset(); _rgn.linesEnd = lines.end(); - _rgn.polygonsOffset = polygons.start(); + _rgn.polygonsOffset = polygons.offset(); _rgn.polygonsEnd = polygons.end(); - _rgn.roadReferencesOffset = roadReferences.start(); + _rgn.roadReferencesOffset = roadReferences.offset(); _rgn.roadReferencesEnd = roadReferences.end(); - _rgn.extPointsOffset = extPoints.start(); + _rgn.extPointsOffset = extPoints.offset(); _rgn.extPointsEnd = extPoints.end(); - _rgn.extLinesOffset = extLines.start(); + _rgn.extLinesOffset = extLines.offset(); _rgn.extLinesEnd = extLines.end(); - _rgn.extPolygonsOffset = extPolygons.start(); + _rgn.extPolygonsOffset = extPolygons.offset(); _rgn.extPolygonsEnd = extPolygons.end(); _init = true;