From 94a1189d757f0269ac081ad2d750152e30564986 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sun, 19 Dec 2010 12:19:41 +0100 Subject: Linked common as submodule. --- common | 1 + common/tile.cpp | 62 --------------------------------------------------------- 2 files changed, 1 insertion(+), 62 deletions(-) create mode 160000 common delete mode 100644 common/tile.cpp (limited to 'common/tile.cpp') diff --git a/common b/common new file mode 160000 index 0000000..dd64a35 --- /dev/null +++ b/common @@ -0,0 +1 @@ +Subproject commit dd64a35c949738c2c321989d065e0754556823d5 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 - -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; -} -- cgit v1.2.3