From ff3f2c3d619479072780fa8311077ac2d35996e1 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Mon, 15 Nov 2010 14:19:06 +0100 Subject: Changed Tile API. --- common/tile.cpp | 7 ++++--- common/tile.h | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/common/tile.cpp b/common/tile.cpp index bf39a4e..f5e1ee4 100644 --- a/common/tile.cpp +++ b/common/tile.cpp @@ -4,10 +4,11 @@ Tile::Tile() { } -Tile::Tile(Tile::Type t) : type(t) { +Tile::Tile(Tile::Type t, Tile::Flags f) : type(t), flags(f) { } -Tile::Tile(uint8_t b) : type((Type)b) { - +Tile::Tile(uint16_t w) { + type = Type(w & 0x00ff); + flags = Flags(w >> 8); } diff --git a/common/tile.h b/common/tile.h index 5dbf69d..6a57da3 100644 --- a/common/tile.h +++ b/common/tile.h @@ -13,7 +13,6 @@ class Tile { Man_2, Man_3, Man_4, - Man_5_red, Man_5, Man_6, Man_7, @@ -24,7 +23,6 @@ class Tile { Pin_2, Pin_3, Pin_4, - Pin_5_red, Pin_5, Pin_6, Pin_7, @@ -35,7 +33,6 @@ class Tile { Sou_2, Sou_3, Sou_4, - Sou_5_red, Sou_5, Sou_6, Sou_7, @@ -49,16 +46,21 @@ class Tile { // Dragons: Chun, Haku, - Hatsu, - // Flags: - Rotated = 0x40 + Hatsu + }; + + enum Flags { + None = 0x00, + Rotated = 0x01, + Red = 0x02 }; Type type; + Flags flags; Tile(); - Tile(Type t); - Tile(uint8_t b); + Tile(Type t, Flags f = None); + Tile(uint16_t w); }; #endif -- cgit v1.2.3