diff options
Diffstat (limited to 'common/tile.h')
-rw-r--r-- | common/tile.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/common/tile.h b/common/tile.h index 93bdb8d..84552aa 100644 --- a/common/tile.h +++ b/common/tile.h @@ -3,6 +3,7 @@ #include <stdint.h> #include <vector> +#include <boost/serialization/base_object.hpp> class Tile { public: @@ -60,10 +61,13 @@ class Tile { virtual ~Tile(){}; //! Get the numeric value of the tile (if one of the man/pin/sou-sets). - int get_num(); + int get_num() const; //! Compare two tiles. Equal if type matches; flags are not compared. - bool operator==(const Tile& other); + bool operator==(const Tile& other) const; + + //! Compare two tiles. Ordered by type, red < non-red. + bool operator<(const Tile& other) const; //! Increment type. Useful for iterating over all possible types. Tile operator++(int); @@ -76,6 +80,16 @@ class Tile { } }; -typedef std::vector<Tile> Tiles; +//! List of tiles. +class Tiles : public std::vector<Tile> { + public: + //! Sort the list of tiles. + void sort(); + + template<class Archive> + void serialize(Archive & ar, const unsigned int version) { + ar & boost::serialization::base_object<std::vector<Tile> >(*this); + } +}; #endif |