/* Copyright 2015, Michele Santullo
* This file is part of DoorKeeper.
*
* DoorKeeper is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DoorKeeper is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DoorKeeper. If not, see .
*/
namespace dkh {
template
TylerMapSource::TylerMapSource (const char* parFilename) :
base_class(new std::ifstream(parFilename))
{
parse_map_data();
}
template
TylerMapSource::TylerMapSource (const std::string& parFilename) :
base_class( new std::ifstream(parFilename))
{
parse_map_data();
}
template
TylerMapSource::TylerMapSource (std::istream* parData) :
base_class(parData)
{
parse_map_data();
}
template
void TylerMapSource::parse_map_data() {
std::vector map_dims;
std::vector tile_dims;
parseMapHeaders(D, map_dims, tile_dims);
DK_ASSERT(map_dims.size() == D);
DK_ASSERT(tile_dims.size() == D);
for (std::size_t z = 0; z < D; ++z) {
m_map_size[z] = map_dims[z];
m_tile_size[z] = tile_dims[z];
}
}
template
const typename TylerMapSource::coords& TylerMapSource::mapSize() const {
return m_map_size;
}
template
const typename TylerMapSource::coords& TylerMapSource::tileSize() const {
return m_tile_size;
}
template
void TylerMapSource::fetch_raw (char* parOut, const coords& parFrom, const coords& parTo, std::size_t parSize) {
//TODO: implement
DK_ASSERT(false);
(void)parOut;
(void)parFrom;
(void)parTo;
(void)parSize;
}
template
dk::MapTypes TylerMapSource::mapType() const {
return base_class::mapType();
}
template
int TylerMapSource::layersCount() const {
return m_layer_count;
}
template
void TylerMapSource::chainedMaps (std::vector& parOut) const {
return base_class::chainedMaps(parOut);
}
template
dk::HashType TylerMapSource::layerTypeHash (int parIndex) const {
return base_class::layerTypeHash(parIndex);
}
} //namespace dkh