Helper recursive map loader.
Recursion not tested since the file format is not ready yet, sorry.
This commit is contained in:
parent
55ca7028b5
commit
a82e8c16f6
9 changed files with 148 additions and 8 deletions
|
@ -10,8 +10,9 @@
|
|||
namespace dkh {
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
AsciiMapSource::AsciiMapSource (const char* parFilename, const coords& parSize, dk::MapTypes parMapType) :
|
||||
AsciiMapSource::AsciiMapSource (const char* parFilename, const coords& parSize, dk::MapTypes parMapType, const coords& parTileSize) :
|
||||
m_mapSize(parSize),
|
||||
m_tileSize(parTileSize),
|
||||
m_bytepos(0),
|
||||
m_mapType(parMapType)
|
||||
{
|
||||
|
@ -21,8 +22,9 @@ namespace dkh {
|
|||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
AsciiMapSource::AsciiMapSource (const std::string& parFilename, const coords& parSize, dk::MapTypes parMapType) :
|
||||
AsciiMapSource::AsciiMapSource (const std::string& parFilename, const coords& parSize, dk::MapTypes parMapType, const coords& parTileSize) :
|
||||
m_mapSize(parSize),
|
||||
m_tileSize(parTileSize),
|
||||
m_bytepos(0),
|
||||
m_mapType(parMapType)
|
||||
{
|
||||
|
@ -32,8 +34,9 @@ namespace dkh {
|
|||
|
||||
///-------------------------------------------------------------------------
|
||||
///-------------------------------------------------------------------------
|
||||
AsciiMapSource::AsciiMapSource (std::istream& parData, const coords& parSize, dk::MapTypes parMapType) :
|
||||
AsciiMapSource::AsciiMapSource (std::istream& parData, const coords& parSize, dk::MapTypes parMapType, const coords& parTileSize) :
|
||||
m_mapSize(parSize),
|
||||
m_tileSize(parTileSize),
|
||||
m_bytepos(0),
|
||||
m_mapType(parMapType)
|
||||
{
|
||||
|
@ -85,6 +88,10 @@ namespace dkh {
|
|||
return m_mapSize;
|
||||
}
|
||||
|
||||
const AsciiMapSource::coords& AsciiMapSource::tileSize() const {
|
||||
return m_tileSize;
|
||||
}
|
||||
|
||||
void AsciiMapSource::fetch (std::vector<MapTileType>& parOut, const coords& parFrom, const coords& parTo) {
|
||||
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;
|
||||
|
@ -100,4 +107,7 @@ namespace dkh {
|
|||
int AsciiMapSource::layersCount() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void AsciiMapSource::chainedMaps (std::vector<std::string>&) const {
|
||||
}
|
||||
} //namespace dkh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue