summaryrefslogtreecommitdiff
path: root/common/tile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/tile.cpp')
m---------common0
-rw-r--r--common/tile.cpp62
2 files changed, 0 insertions, 62 deletions
diff --git a/common b/common
new file mode 160000
+Subproject dd64a35c949738c2c321989d065e0754556823d
diff --git a/common/tile.cpp b/common/tile.cpp
deleted file mode 100644
index 4b1f8b5..0000000
--- a/common/tile.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "tile.h"
-
-#include <algorithm>
-
-Tile::Tile(Tile::Type t, bool re) : type(t), red(re), rotated(false), invisible(false) {
-
-}
-
-Tile::Tile(Set s, int num, bool re) : red(re), rotated(false), invisible(false) {
- switch(s) {
- case Man:
- type = Type(Man_1 + num - 1);
- break;
- case Pin:
- type = Type(Pin_1 + num - 1);
- break;
- case Sou:
- type = Type(Sou_1 + num - 1);
- break;
- default:
- // Invalid.
- break;
- }
-}
-
-int Tile::get_num() const {
- if(type >= Man_1 && type <= Sou_9) {
- return (type - Man_1) % 9 + 1;
- } else {
- return 0;
- }
-}
-
-Tile::Set Tile::get_set() const {
- if(type >= Man_1 && type <= Man_9) {
- return Man;
- } else if(type >= Pin_1 && type <= Pin_9) {
- return Pin;
- } else if(type >= Sou_1 && type <= Sou_9) {
- return Sou;
- } else {
- return Honor;
- }
-}
-
-bool Tile::is_simple() const {
- int n = get_num();
- return n > 1 && n < 9;
-}
-
-bool Tile::operator==(const Tile& other) const {
- return type == other.type;
-}
-
-bool Tile::operator<(const Tile& other) const {
- return type == other.type ? red : type < other.type;
-}
-
-Tile Tile::operator++(int) {
- type = Type(type + 1);
- return *this;
-}