From 50b1e9a48eac8667799222a404d60dbbc0963d35 Mon Sep 17 00:00:00 2001 From: Connor Date: Mon, 4 Jun 2018 11:14:04 -0700 Subject: [PATCH] --- tennis.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tennis.c b/tennis.c index 96c79ec..dce7a93 100644 --- a/tennis.c +++ b/tennis.c @@ -76,6 +76,14 @@ typedef enum { MT_DOUBLES_POINT_3, } gamemode_t; +typedef enum { + MT_HARD, + MT_CLAY, + MT_GRASS, + MT_COMPOSITION, + MT_OPEN, +} court_t; + typedef struct { char code[9]; // data[0]: cup name @@ -110,7 +118,7 @@ code_t translate(const char *entry) { } int check_ranges(const code_t *code) { - const u32 neg1 = (u32)-1; + const u32 choice = (u32)MT_CHOICE; const u32 *data = code->data; return @@ -121,8 +129,8 @@ int check_ranges(const code_t *code) { (data[4] + 1 < bases[4] - 4) && (data[5] < bases[5]) && (data[6] + 1 < bases[6]) && - (data[2] == neg1 || data[2] != data[4]) && - (data[1] < 7 || (data[2] != neg1 && data[4] != neg1)); + (data[2] == choice || data[2] != data[4]) && + (data[1] < 7 || (data[2] != choice && data[4] != choice)); } int decode_data(code_t *code) {