diff options
author | Sergeanur <s.anureev@yandex.ua> | 2019-10-08 23:07:11 +0300 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2019-10-08 23:07:11 +0300 |
commit | 101192dd322197d1f9e4aa4e48e38b43e05cd72b (patch) | |
tree | ae00316a66f04bd5459dcd8b7b325fb819c7ba06 /src/control/PathFind.cpp | |
parent | 69963cea68b3057c0e590e30ee438dff801a4d07 (diff) |
Added read/write template functions for save data, small Load/Save arguments unification
Diffstat (limited to 'src/control/PathFind.cpp')
-rw-r--r-- | src/control/PathFind.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index e9b33395..e9276dde 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -1409,40 +1409,40 @@ CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start) } void -CPathFind::Save(uint8 *buffer, uint32 *length) +CPathFind::Save(uint8 *buf, uint32 *size) { int i; int n = m_numPathNodes/8 + 1; - *length = 2*n; + *size = 2*n; for(i = 0; i < m_numPathNodes; i++) if(m_pathNodes[i].bDisabled) - buffer[i/8] |= 1 << i%8; + buf[i/8] |= 1 << i%8; else - buffer[i/8] &= ~(1 << i%8); + buf[i/8] &= ~(1 << i%8); for(i = 0; i < m_numPathNodes; i++) if(m_pathNodes[i].bBetweenLevels) - buffer[i/8 + n] |= 1 << i%8; + buf[i/8 + n] |= 1 << i%8; else - buffer[i/8 + n] &= ~(1 << i%8); + buf[i/8 + n] &= ~(1 << i%8); } void -CPathFind::Load(uint8 *buffer, uint32 length) +CPathFind::Load(uint8 *buf, uint32 size) { int i; int n = m_numPathNodes/8 + 1; for(i = 0; i < m_numPathNodes; i++) - if(buffer[i/8] & (1 << i%8)) + if(buf[i/8] & (1 << i%8)) m_pathNodes[i].bDisabled = true; else m_pathNodes[i].bDisabled = false; for(i = 0; i < m_numPathNodes; i++) - if(buffer[i/8 + n] & (1 << i%8)) + if(buf[i/8 + n] & (1 << i%8)) m_pathNodes[i].bBetweenLevels = true; else m_pathNodes[i].bBetweenLevels = false; |