2014-12-22 15:59:09 +00:00
|
|
|
#ifndef id263B7DAF9A1C40BB8517D5D328DF8A1B
|
|
|
|
#define id263B7DAF9A1C40BB8517D5D328DF8A1B
|
|
|
|
|
2015-01-06 15:38:52 +00:00
|
|
|
#include "doorkeeper/primitivetypes.hpp"
|
|
|
|
#include "doorkeeper/implem/vector.hpp"
|
2015-05-24 23:37:20 +00:00
|
|
|
#include "doorkeeper/components/basemapsource.hpp"
|
2014-12-22 15:59:09 +00:00
|
|
|
#include <vector>
|
2015-05-24 23:37:20 +00:00
|
|
|
#include <memory>
|
2014-12-22 15:59:09 +00:00
|
|
|
|
|
|
|
namespace dkh {
|
2015-05-24 23:37:20 +00:00
|
|
|
namespace implem {
|
|
|
|
typedef int AsciiMapTileType;
|
|
|
|
} //namespace implem
|
|
|
|
|
2015-06-06 12:14:00 +00:00
|
|
|
class AsciiMapSource : public dk::BaseMapSource<2> {
|
2014-12-22 15:59:09 +00:00
|
|
|
public:
|
2015-06-06 11:52:48 +00:00
|
|
|
typedef dk::Vector<2> coords;
|
2015-05-24 23:37:20 +00:00
|
|
|
typedef implem::AsciiMapTileType MapTileType;
|
2014-12-22 15:59:09 +00:00
|
|
|
enum {
|
|
|
|
MapDimensions = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
AsciiMapSource ( void ) = delete;
|
2015-01-05 17:01:28 +00:00
|
|
|
AsciiMapSource ( const AsciiMapSource& ) = delete;
|
|
|
|
AsciiMapSource ( AsciiMapSource&& parOther ) = default;
|
2015-05-27 22:20:40 +00:00
|
|
|
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 );
|
2015-05-24 23:37:20 +00:00
|
|
|
virtual ~AsciiMapSource ( void ) noexcept = default;
|
|
|
|
|
|
|
|
virtual const coords& mapSize ( void ) const;
|
|
|
|
virtual dk::MapTypes mapType ( void ) const;
|
|
|
|
virtual int layersCount ( void ) const;
|
2015-05-27 22:20:40 +00:00
|
|
|
virtual const coords& tileSize ( void ) const;
|
|
|
|
virtual void chainedMaps ( std::vector<std::string>& parOut ) const;
|
2015-06-07 01:57:18 +00:00
|
|
|
virtual dk::HashType layerTypeHash ( int parIndex ) const;
|
2015-01-05 17:01:28 +00:00
|
|
|
|
2014-12-22 15:59:09 +00:00
|
|
|
private:
|
|
|
|
void parse_map_data ( std::istream& parSrc );
|
2015-06-06 12:14:00 +00:00
|
|
|
virtual void fetch_raw ( char* parOut, const coords& parFrom, const coords& parTo, std::size_t parSize );
|
2014-12-22 15:59:09 +00:00
|
|
|
|
|
|
|
std::vector<MapTileType> m_wholedata;
|
2015-05-21 07:52:45 +00:00
|
|
|
const coords m_mapSize;
|
2015-05-27 22:20:40 +00:00
|
|
|
const coords m_tileSize;
|
2015-05-24 23:37:20 +00:00
|
|
|
const dk::MapTypes m_mapType;
|
2014-12-22 15:59:09 +00:00
|
|
|
};
|
2014-12-29 15:14:36 +00:00
|
|
|
} //namespace dkh
|
2014-12-22 15:59:09 +00:00
|
|
|
|
|
|
|
#endif
|