diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-11-25 01:50:08 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-11-25 02:04:12 +0100 |
commit | a56f67de16faaeb730375814faa22d406eaca19b (patch) | |
tree | ce3868f31c819d2743993441c59a6aa5eaf26e81 /common/tile.cpp | |
parent | 91fd9441dad8b4b7eb680268e2fc8e03a0b37078 (diff) |
Added get_num(), operator==() and operator++() to Tile.
Diffstat (limited to 'common/tile.cpp')
-rw-r--r-- | common/tile.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/common/tile.cpp b/common/tile.cpp index 1b3dcd7..15d0d9d 100644 --- a/common/tile.cpp +++ b/common/tile.cpp @@ -7,3 +7,20 @@ Tile::Tile() { Tile::Tile(Tile::Type t, bool re, bool ro) : type(t), red(re), rotated(ro){ } + +int Tile::get_num() { + if(type >= Man_1 && type <= Sou_9) { + return (type - Man_1) % 9 + 1; + } else { + return 0; + } +} + +bool Tile::operator==(const Tile& other) { + return type == other.type; +} + +Tile Tile::operator++(int) { + type = Type(type + 1); + return *this; +}
\ No newline at end of file |