This commit is contained in:
Connor 2018-06-04 11:14:04 -07:00 committed by GitHub
parent cd0b5a8b4b
commit 50b1e9a48e

View file

@ -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) {