53 lines
1.8 KiB
C++
53 lines
1.8 KiB
C++
#ifndef id263B7DAF9A1C40BB8517D5D328DF8A1B
|
|
#define id263B7DAF9A1C40BB8517D5D328DF8A1B
|
|
|
|
#include "doorkeeper/primitivetypes.hpp"
|
|
#include "doorkeeper/implem/vector.hpp"
|
|
#include "doorkeeper/components/basemapsource.hpp"
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
namespace dkh {
|
|
namespace implem {
|
|
typedef int AsciiMapTileType;
|
|
} //namespace implem
|
|
|
|
class AsciiMapSource : public dk::BaseMapSource<implem::AsciiMapTileType, 2> {
|
|
public:
|
|
typedef dk::Vector<dk::CoordinateScalarType, 2> coords;
|
|
typedef implem::AsciiMapTileType MapTileType;
|
|
enum {
|
|
MapDimensions = 2
|
|
};
|
|
|
|
AsciiMapSource ( void ) = delete;
|
|
AsciiMapSource ( const AsciiMapSource& ) = delete;
|
|
AsciiMapSource ( AsciiMapSource&& parOther ) = default;
|
|
AsciiMapSource ( const char* parFilename, const coords& parSize, dk::MapTypes parMapType, const coords& parTileSize );
|
|
AsciiMapSource ( const std::string& parFilename, const coords& parSize, dk::MapTypes parMapType, const coords& parTileSize );
|
|
AsciiMapSource ( std::istream& parData, const coords& parSize, dk::MapTypes parMapType, const coords& parTileSize );
|
|
virtual ~AsciiMapSource ( void ) noexcept = default;
|
|
|
|
virtual const coords& mapSize ( void ) const;
|
|
virtual void fetch ( std::vector<MapTileType>& parOut, const coords& parFrom, const coords& parTo );
|
|
virtual dk::MapTypes mapType ( void ) const;
|
|
virtual int layersCount ( void ) const;
|
|
virtual const coords& tileSize ( void ) const;
|
|
virtual void chainedMaps ( std::vector<std::string>& parOut ) const;
|
|
|
|
private:
|
|
enum {
|
|
DataSize = sizeof(MapTileType)
|
|
};
|
|
|
|
void parse_map_data ( std::istream& parSrc );
|
|
|
|
std::vector<MapTileType> m_wholedata;
|
|
const coords m_mapSize;
|
|
const coords m_tileSize;
|
|
std::size_t m_bytepos;
|
|
const dk::MapTypes m_mapType;
|
|
};
|
|
} //namespace dkh
|
|
|
|
#endif
|