1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Some more code cleanup

This commit is contained in:
Martin Tůma 2021-09-30 20:26:16 +02:00
parent 505d7271f1
commit 3d4adba90a
2 changed files with 10 additions and 10 deletions

View File

@ -118,9 +118,9 @@ bool NODFile::readBlock(Handle &hdl, quint32 blockOffset,
return (seek(hdl, blockInfo.offset + _blockOffset) return (seek(hdl, blockInfo.offset + _blockOffset)
&& readUInt16(hdl, blockInfo.hdr.flags) && readUInt16(hdl, blockInfo.hdr.flags)
&& readUInt32(hdl, blockInfo.hdr.baseLon) && readUInt32(hdl, blockInfo.hdr.nodeLonBase)
&& readUInt32(hdl, blockInfo.hdr.baseLat) && readUInt32(hdl, blockInfo.hdr.nodeLatBase)
&& readUInt32(hdl, blockInfo.hdr.unk) && readUInt32(hdl, blockInfo.hdr.linkInfoOffsetBase)
&& readUInt16(hdl, blockInfo.hdr.linkInfoSize) && readUInt16(hdl, blockInfo.hdr.linkInfoSize)
&& readByte(hdl, &blockInfo.hdr.linksCount) && readByte(hdl, &blockInfo.hdr.linksCount)
&& readByte(hdl, &blockInfo.hdr.nodesCount) && readByte(hdl, &blockInfo.hdr.nodesCount)
@ -169,7 +169,7 @@ bool NODFile::linkInfo(Handle &hdl, const BlockInfo &blockInfo, quint32 linkId,
} else { } else {
if (!bs.read(s1 - s2, linkInfo.linkOffset)) if (!bs.read(s1 - s2, linkInfo.linkOffset))
return false; return false;
linkInfo.linkOffset += blockInfo.hdr.unk; linkInfo.linkOffset += blockInfo.hdr.linkInfoOffsetBase;
} }
if (!bs.read(s2, linkInfo.nodeOffset)) if (!bs.read(s2, linkInfo.nodeOffset))
@ -207,9 +207,9 @@ bool NODFile::nodeInfo(Handle &hdl, const BlockInfo &blockInfo,
quint8 lonShift = 0x20 - lonBits; quint8 lonShift = 0x20 - lonBits;
quint8 latShift = 0x20 - latBits; quint8 latShift = 0x20 - latBits;
quint8 shift = 0x20 - maxBits; quint8 shift = 0x20 - maxBits;
QPoint pos((((int)(lon << lonShift) >> lonShift) << shift) QPoint pos(
+ blockInfo.hdr.baseLon, (((int)(lat << latShift) >> latShift) << shift) (((int)(lon << lonShift) >> lonShift) << shift) + blockInfo.hdr.nodeLonBase,
+ blockInfo.hdr.baseLat); (((int)(lat << latShift) >> latShift) << shift) + blockInfo.hdr.nodeLatBase);
nodeInfo.bytes = ((lonBits + latBits) >> 3) + 1; nodeInfo.bytes = ((lonBits + latBits) >> 3) + 1;
if ((maxBits < 0x1c) && (nodeInfo.flags & 8)) { if ((maxBits < 0x1c) && (nodeInfo.flags & 8)) {

View File

@ -12,9 +12,9 @@ public:
{ {
struct BlockHeader struct BlockHeader
{ {
quint32 baseLon; quint32 nodeLonBase;
quint32 baseLat; quint32 nodeLatBase;
quint32 unk; quint32 linkInfoOffsetBase;
quint16 flags; quint16 flags;
quint16 linkInfoSize; quint16 linkInfoSize;
quint8 linksCount; quint8 linksCount;