summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@sakuya.local>2010-11-06 06:08:48 +0100
committerVegard Storheil Eriksen <zyp@sakuya.local>2010-11-06 06:08:48 +0100
commita3f731edf8a65c1728968cad837d4ca0bfbeb833 (patch)
tree604c9784af4d46d5103027acdbec35f2d32fdbf3
parentd1b97b2ad19d18377f712b4ed14c8a47db375f62 (diff)
Added Tile-class.
-rw-r--r--common/tile.cpp13
-rw-r--r--common/tile.h64
2 files changed, 77 insertions, 0 deletions
diff --git a/common/tile.cpp b/common/tile.cpp
new file mode 100644
index 0000000..bf39a4e
--- /dev/null
+++ b/common/tile.cpp
@@ -0,0 +1,13 @@
+#include "tile.h"
+
+Tile::Tile() {
+
+}
+
+Tile::Tile(Tile::Type t) : type(t) {
+
+}
+
+Tile::Tile(uint8_t b) : type((Type)b) {
+
+}
diff --git a/common/tile.h b/common/tile.h
new file mode 100644
index 0000000..5dbf69d
--- /dev/null
+++ b/common/tile.h
@@ -0,0 +1,64 @@
+#ifndef TILE_H
+#define TILE_H
+
+#include <stdint.h>
+
+class Tile {
+ public:
+ enum Type {
+ // Face-down tile:
+ Back,
+ // Characters set:
+ Man_1,
+ Man_2,
+ Man_3,
+ Man_4,
+ Man_5_red,
+ Man_5,
+ Man_6,
+ Man_7,
+ Man_8,
+ Man_9,
+ // Circles set:
+ Pin_1,
+ Pin_2,
+ Pin_3,
+ Pin_4,
+ Pin_5_red,
+ Pin_5,
+ Pin_6,
+ Pin_7,
+ Pin_8,
+ Pin_9,
+ // Bamboo set:
+ Sou_1,
+ Sou_2,
+ Sou_3,
+ Sou_4,
+ Sou_5_red,
+ Sou_5,
+ Sou_6,
+ Sou_7,
+ Sou_8,
+ Sou_9,
+ // Winds:
+ Ton,
+ Nan,
+ Xia,
+ Pei,
+ // Dragons:
+ Chun,
+ Haku,
+ Hatsu,
+ // Flags:
+ Rotated = 0x40
+ };
+
+ Type type;
+
+ Tile();
+ Tile(Type t);
+ Tile(uint8_t b);
+};
+
+#endif