2015-05-28 22:15:06 +00:00
|
|
|
namespace dkh {
|
2015-06-06 12:14:00 +00:00
|
|
|
template <uint32_t D>
|
|
|
|
TylerMapSource<D>::TylerMapSource (const char* parFilename) :
|
2015-06-28 17:11:21 +00:00
|
|
|
base_class(m_stream->tellg()),
|
|
|
|
m_stream(new std::ifstream(parFilename))
|
2015-05-28 22:15:06 +00:00
|
|
|
{
|
2015-06-06 12:32:36 +00:00
|
|
|
parse_map_data(*m_stream);
|
2015-05-28 22:15:06 +00:00
|
|
|
}
|
|
|
|
|
2015-06-06 12:14:00 +00:00
|
|
|
template <uint32_t D>
|
|
|
|
TylerMapSource<D>::TylerMapSource (const std::string& parFilename) :
|
2015-06-28 17:11:21 +00:00
|
|
|
base_class(m_stream->tellg()),
|
|
|
|
m_stream(new std::ifstream(parFilename))
|
2015-05-28 22:15:06 +00:00
|
|
|
{
|
2015-06-06 12:32:36 +00:00
|
|
|
parse_map_data(*m_stream);
|
2015-05-28 22:15:06 +00:00
|
|
|
}
|
|
|
|
|
2015-06-06 12:14:00 +00:00
|
|
|
template <uint32_t D>
|
|
|
|
TylerMapSource<D>::TylerMapSource (std::istream* parData) :
|
2015-06-28 17:11:21 +00:00
|
|
|
base_class(m_stream->tellg()),
|
|
|
|
m_stream(parData)
|
2015-05-28 22:15:06 +00:00
|
|
|
{
|
2015-06-06 12:32:36 +00:00
|
|
|
parse_map_data(*m_stream);
|
2015-05-28 22:15:06 +00:00
|
|
|
}
|
|
|
|
|
2015-06-06 12:32:36 +00:00
|
|
|
template <uint32_t D>
|
|
|
|
void TylerMapSource<D>::parse_map_data (std::istream& parSrc) {
|
2015-06-28 17:11:21 +00:00
|
|
|
std::vector<uint32_t> map_dims;
|
|
|
|
std::vector<uint16_t> tile_dims;
|
2015-06-06 12:32:36 +00:00
|
|
|
|
2015-06-28 17:11:21 +00:00
|
|
|
parseMapHeaders(parSrc, 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];
|
2015-06-06 12:32:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <uint32_t D>
|
|
|
|
const typename TylerMapSource<D>::coords& TylerMapSource<D>::mapSize() const {
|
|
|
|
return m_map_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <uint32_t D>
|
|
|
|
const typename TylerMapSource<D>::coords& TylerMapSource<D>::tileSize() const {
|
|
|
|
return m_tile_size;
|
|
|
|
}
|
2015-05-28 22:15:06 +00:00
|
|
|
|
2015-06-06 12:32:36 +00:00
|
|
|
template <uint32_t D>
|
|
|
|
void TylerMapSource<D>::fetch_raw (char* parOut, const coords& parFrom, const coords& parTo, std::size_t parSize) {
|
|
|
|
(void)parOut;
|
|
|
|
(void)parFrom;
|
|
|
|
(void)parTo;
|
|
|
|
(void)parSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <uint32_t D>
|
|
|
|
dk::MapTypes TylerMapSource<D>::mapType() const {
|
2015-06-28 17:11:21 +00:00
|
|
|
return base_class::mapType();
|
2015-06-06 12:32:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <uint32_t D>
|
|
|
|
int TylerMapSource<D>::layersCount() const {
|
|
|
|
return m_layer_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <uint32_t D>
|
|
|
|
void TylerMapSource<D>::chainedMaps (std::vector<std::string>& parOut) const {
|
2015-06-28 17:11:21 +00:00
|
|
|
return base_class::chainedMaps(parOut);
|
2015-06-06 12:32:36 +00:00
|
|
|
}
|
2015-06-07 01:57:18 +00:00
|
|
|
|
|
|
|
template <uint32_t D>
|
|
|
|
dk::HashType TylerMapSource<D>::layerTypeHash (int parIndex) const {
|
2015-06-28 17:11:21 +00:00
|
|
|
return base_class::layerTypeHash(parIndex);
|
2015-06-07 01:57:18 +00:00
|
|
|
}
|
2015-05-28 22:15:06 +00:00
|
|
|
} //namespace dkh
|