#include <compressed_map.h>
Public Methods | |
CompressedMap (Map const &map) | |
CompressedMap (QDataStream &stream) | |
int | width () const |
int | height () const |
int | numberOfEmptyGoals () const |
int | keeperIndex () const |
void | setPieces (std::vector< int > &pieces) const |
bool | operator== (CompressedMap const &other_map) const |
bool | operator!= (CompressedMap const &other_map) const |
bool | operator< (CompressedMap const &other_map) const |
void | writeToStream (QDataStream &stream) const |
Private Methods | |
int | codesLength () const |
Private Attributes | |
Q_UINT8 | m_width |
Q_UINT8 | m_height |
Q_UINT16 | m_empty_goals |
Q_UINT16 | m_keeper_index |
std::vector< Q_UINT32 > | m_codes |
This class is used for fast loading and storing and to check if to maps are equal. It also provides all operators to use it as a key in std::map<>.
Note, that Map itself uses a CompressedMap for loading and saving.
The format of a compressed map is easy. We simply store the pieces (which are in the range [0:8[) in 32 bit integers. Because a piece takes 3 bits, we can store 10 pieces per int.
|
Constructs the compressed map from a normal map.
|
|
Constructs the compressed map from a data stream.
|
|
Returns the length of the code array.
|
|
Returns the height of the map.
|
|
Returns the index of the keeper.
|
|
Returns the number of empty goals (without a gem).
|
|
Compares to maps for inequality.
|
|
This is needed for associative containers like std::map.
|
|
Compares to maps for equality.
|
|
Fills the given vector with the piece codes suitable to create a Map.
|
|
Returns the width of the map.
|
|
Writes the compressed map to a data stream.
|
|
Here we store the compressed moves.
|
|
The number of empty goals in the map.
|
|
The height of the map.
|
|
The index of the keeper.
|
|
The width of the map.
|