DoorKeeper/include/implem/tileiterator.inl
King_DuckZ e63aebe6e1 Some changes and the build is fine again.
This is a test version, design is still in progress.
2014-12-09 22:30:06 +01:00

46 lines
1.1 KiB
C++

namespace dk {
template <typename T, size_t D>
TileIterator<T, D>::TileIterator() :
m_pos(CoordinateScalarType()),
m_from(CoordinateScalarType()),
m_to(CoordinateScalarType()),
m_areafrom(CoordinateScalarType()),
m_areato(CoordinateScalarType()),
m_total(CoordinateScalarType())
{
}
template <typename T, size_t D>
TileIterator<T, D>::TileIterator (const coords& parFrom, const coords& parTo) :
m_pos(parFrom),
m_from(parFrom),
m_to(parTo),
m_areafrom(parFrom),
m_areato(parTo),
m_total(parTo - parFrom)
{
}
template <typename T, size_t D>
TileIterator<T, D>::TileIterator (const coords& parFrom, const coords& parTo, const coords& parAreaFrom, const coords& parAreaTo, const coords& parTotal) :
m_pos(parFrom),
m_from(parFrom),
m_to(parTo),
m_areafrom(parAreaFrom),
m_areato(parAreaTo),
m_total(parTotal)
{
}
template <typename T, size_t D>
void TileIterator<T, D>::increment() {
for (size_t d = 0; d < D - 1; ++d) {
++m_pos[d];
if (m_pos[d] >= m_areato[d])
m_pos[d] = m_areafrom[d];
else
return;
}
++m_pos[D - 1];
}
} //namespace dk