summaryrefslogtreecommitdiff
path: root/common/tile.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/tile.h')
m---------common0
-rw-r--r--common/tile.h105
2 files changed, 0 insertions, 105 deletions
diff --git a/common b/common
new file mode 160000
+Subproject dd64a35c949738c2c321989d065e0754556823d
diff --git a/common/tile.h b/common/tile.h
deleted file mode 100644
index 83ec10b..0000000
--- a/common/tile.h
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifndef TILE_H
-#define TILE_H
-
-#include "list.h"
-
-class Tile {
- public:
- enum Type {
- // Face-down tile:
- Back,
- // Characters set:
- Man_1,
- Man_2,
- Man_3,
- Man_4,
- Man_5,
- Man_6,
- Man_7,
- Man_8,
- Man_9,
- // Circles set:
- Pin_1,
- Pin_2,
- Pin_3,
- Pin_4,
- Pin_5,
- Pin_6,
- Pin_7,
- Pin_8,
- Pin_9,
- // Bamboo set:
- Sou_1,
- Sou_2,
- Sou_3,
- Sou_4,
- Sou_5,
- Sou_6,
- Sou_7,
- Sou_8,
- Sou_9,
- // Winds:
- Ton,
- Nan,
- Xia,
- Pei,
- // Dragons:
- Chun,
- Haku,
- Hatsu
- };
-
- enum Set {
- Honor,
- Man,
- Pin,
- Sou
- };
-
- Type type;
- bool red;
- bool rotated;
- bool invisible;
-
- //! Construct tile by type.
- Tile(Type t = Back, bool re = false);
-
- //! Construct tile by set and number.
- Tile(Set s, int num, bool re = false);
-
- virtual ~Tile(){};
-
- //! Get the numeric value of the tile (if one of the man/pin/sou-sets).
- int get_num() const;
-
- //! Get the set type of the tile (if one of the man/pin/sou-sets).
- Set get_set() const;
-
- //! Check if the tile is one of the simples (e.g. 2-8).
- bool is_simple() const;
-
- //! Compare two tiles. Equal if type matches; flags are not compared.
- 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);
-
- template<class Archive>
- void serialize(Archive & ar, const unsigned int version) {
- ar & type;
- ar & red;
- ar & rotated;
- ar & invisible;
- }
-};
-
-//! List of tiles.
-typedef List<Tile> Tiles;
-
-//! List of list of tiles.
-typedef List<Tiles> Tilegroups;
-
-#endif