Add unit test for AsciiMapSource and fix issues.
This commit is contained in:
parent
7085a98995
commit
42da727a67
8 changed files with 66 additions and 11 deletions
|
@ -93,10 +93,10 @@ namespace dkh {
|
|||
|
||||
void AsciiMapSource::fetch_raw (char* parOut, const coords& parFrom, const coords& parTo, std::size_t parSize) {
|
||||
const std::size_t from = parFrom.x() + parFrom.y() * m_mapSize.x();
|
||||
const std::size_t to = parTo.x() + parTo.y() * m_mapSize.x() + 1;
|
||||
const std::size_t to = parTo.x() - 1 + (parTo.y() - 1) * m_mapSize.x() + 1;
|
||||
DK_ASSERT(to >= from);
|
||||
DK_ASSERT(parSize / sizeof(MapTileType) == to - from);
|
||||
std::copy(m_wholedata.begin() + from, m_wholedata.begin() + to, parOut);
|
||||
std::copy(m_wholedata.begin() + from, m_wholedata.begin() + to, reinterpret_cast<MapTileType*>(parOut));
|
||||
}
|
||||
|
||||
dk::MapTypes AsciiMapSource::mapType() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue