bool CHand::CanChow(const CTile &t, int location) { CTile to_find[2]; if (t.GetSuit() & (TILESUIT_WIND | TILESUIT_DRAGON)) return false; // cannot chow wind or dragon tiles switch (location) { case CHOW_LOWER: if (t.GetValue() > 7) return false; to_find[0] = t() + 1; to_find[1] = t() + 2; break; case CHOW_MIDDLE: if (t.GetValue() == 1 || t.GetValue() == 9) return false; to_find[0] = t() - 1; to_find[1] = t() + 1; break; case CHOW_UPPER: if (t.GetValue() < 3) return false; to_find[0] = t() - 1; to_find[1] = t() - 2; break; default: TerminateOnError("CHand::Chow(): Invalid location"); return false; } return (HasTile(to_find[0]) && HasTile(to_find[1])); }
m_mutex.Unlock(); } bool TileSet::HasTile(Tiler::RectInfo const & rectInfo) { return m_tiles.find(rectInfo) != m_tiles.end(); } void TileSet::AddTile(Tile const & tile) { m_tiles[tile.m_rectInfo] = tile; } int TileSet::GetTileSequenceID(Tiler::RectInfo const & rectInfo) { ASSERT(HasTile(rectInfo), ()); return m_tiles[rectInfo].m_sequenceID; } void TileSet::SetTileSequenceID(Tiler::RectInfo const & rectInfo, int sequenceID) { ASSERT(HasTile(rectInfo), ()); m_tiles[rectInfo].m_sequenceID = sequenceID; } void TileSet::RemoveTile(const Tiler::RectInfo &rectInfo) { m_tiles.erase(rectInfo); } Tile const & TileSet::GetTile(Tiler::RectInfo const & rectInfo)