From 7c3c72a0fdfc46bf41dfcc9ff6cd3712c27a6ec8 Mon Sep 17 00:00:00 2001 From: Murilo Soares Pereira Date: Thu, 1 Apr 2010 10:13:37 -0300 Subject: [PATCH] Adding irrelevant values to enums. --- lib/card.c | 6 +++--- lib/card.h | 40 ++++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/lib/card.c b/lib/card.c index 43ffb82..f6a27c9 100644 --- a/lib/card.c +++ b/lib/card.c @@ -10,9 +10,9 @@ struct card *initialize_card() { card = malloc(sizeof(card)); card->frame = initialize_frame(); - card->value = NONE; - card->suit = NONE; - card->face = COVERED; + card->value = NO_VALUE; + card->suit = NO_SUIT; + card->face = NO_FACE; return(card); } diff --git a/lib/card.h b/lib/card.h index 049bd84..7367603 100644 --- a/lib/card.h +++ b/lib/card.h @@ -1,33 +1,37 @@ #ifndef CARD_H #define CARD_H +enum value { + NO_VALUE = -1, + TWO = 2, + THREE = 3, + FOUR = 4, + FIVE = 5, + SIX = 6, + SEVEN = 7, + EIGHT = 8, + NINE = 9, + TEN = 10, + JACK = 11, + QUEEN = 12, + KING = 13, + ACE = 14 +}; + enum suit { - BLANK = -1, + NO_SUIT = -1, DIAMONDS = 0, SPADES = 1, HEARTS = 2, CLUBS = 3 }; -enum value { - NONE = -1, - TWO = 2, - THREE = 3, - FOUR = 4, - FIVE = 5, - SIX = 6, - SEVEN = 7, - EIGHT = 8, - NINE = 9, - TEN = 10, - JACK = 11, - QUEEN = 12, - KING = 13, - ACE = 14 +enum face { + NO_FACE = -1, + COVERED = 0, + EXPOSED = 1 }; -enum face { COVERED, EXPOSED }; - struct card { struct frame *frame; enum value value;