13 #include "../clib/binaryfile.h" 14 #include "../clib/passert.h" 15 #include "../clib/strutil.h" 53 throw std::runtime_error( filename +
" must have size of at least " +
56 std::fstream::pos_type databytes = filesize - std::fstream::pos_type(
SOLIDX2_FILLER_SIZE );
58 throw std::runtime_error( filename +
" does not contain an integral number of elements." );
60 size_t count =
static_cast<size_t>( databytes /
sizeof(
SOLIDX2_ELEM ) );
66 for (
const auto& elem :
_index2 )
74 size_t idx = elem.baseindex + elem.addindex[x][y];
90 for (
size_t i = 0; i < n_blocks; ++i )
108 unsigned int anyflags )
const 115 if ( cell.
flags & anyflags )
118 shape.
z = cell.
z - 1;
120 shapes.push_back( shape );
130 size_t block =
static_cast<size_t>( yblock ) * (
_descriptor.
width >> SOLIDX_X_SHIFT ) + xblock;
136 if ( pElem->
flags & anyflags )
141 shapes.push_back( shape );
163 throw std::runtime_error(
"Undefined mapserver type: " + descriptor.
mapserver_type );
169 size_t size =
sizeof( *this );
MapServer(const RealmDescriptor &descriptor)
void LoadSecondLevelIndex()
void GetMapShapes(MapShapeList &list, unsigned short x, unsigned short y, unsigned int anyflags) const
std::string decint(unsigned short v)
static MapServer * Create(const RealmDescriptor &descriptor)
std::fstream::pos_type FileSize()
unsigned short addindex[SOLIDX_X_SIZE][SOLIDX_Y_SIZE]
size_t sizeEstimate() const
#define SOLIDX_Y_CELLMASK
virtual size_t sizeEstimate() const
int filesize(const char *fname)
std::string mapserver_type
std::vector< SOLIDS_ELEM > _shapedata
std::vector< SOLIDX2_ELEM > _index2
virtual MAPCELL GetMapCell(unsigned short x, unsigned short y) const =0
const RealmDescriptor _descriptor
std::vector< SOLIDX2_ELEM * > _index1
void Seek(std::fstream::pos_type abs_offset)
std::string path(const std::string &filename) const
void LoadFirstLevelIndex()
const unsigned SOLIDX2_FILLER_SIZE
void ReadVector(std::vector< T > &vec)
#define SOLIDX_X_CELLMASK