mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 07:31:30 -07:00
Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Cube
This commit is contained in:
10
cube.c
10
cube.c
@ -1145,7 +1145,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
|
|||||||
cy = (int)(state->grid->squares[state->current].y * GRID_SCALE) + ds->oy;
|
cy = (int)(state->grid->squares[state->current].y * GRID_SCALE) + ds->oy;
|
||||||
|
|
||||||
if (x == cx && y == cy)
|
if (x == cx && y == cy)
|
||||||
return NULL; /* clicked in exact centre! */
|
return MOVE_NO_EFFECT; /* clicked in exact centre! */
|
||||||
angle = atan2(y - cy, x - cx);
|
angle = atan2(y - cy, x - cx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1196,11 +1196,11 @@ static char *interpret_move(const game_state *state, game_ui *ui,
|
|||||||
direction = RIGHT;
|
direction = RIGHT;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return NULL;
|
return MOVE_UNUSED;
|
||||||
|
|
||||||
mask = state->grid->squares[state->current].directions[direction];
|
mask = state->grid->squares[state->current].directions[direction];
|
||||||
if (mask == 0)
|
if (mask == 0)
|
||||||
return NULL;
|
return MOVE_NO_EFFECT;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Translate diagonal directions into orthogonal ones.
|
* Translate diagonal directions into orthogonal ones.
|
||||||
@ -1215,14 +1215,14 @@ static char *interpret_move(const game_state *state, game_ui *ui,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (find_move_dest(state, direction, skey, dkey) < 0)
|
if (find_move_dest(state, direction, skey, dkey) < 0)
|
||||||
return NULL;
|
return MOVE_NO_EFFECT;
|
||||||
|
|
||||||
if (direction == LEFT) return dupstr("L");
|
if (direction == LEFT) return dupstr("L");
|
||||||
if (direction == RIGHT) return dupstr("R");
|
if (direction == RIGHT) return dupstr("R");
|
||||||
if (direction == UP) return dupstr("U");
|
if (direction == UP) return dupstr("U");
|
||||||
if (direction == DOWN) return dupstr("D");
|
if (direction == DOWN) return dupstr("D");
|
||||||
|
|
||||||
return NULL; /* should never happen */
|
return MOVE_NO_EFFECT; /* should never happen */
|
||||||
}
|
}
|
||||||
|
|
||||||
static game_state *execute_move(const game_state *from, const char *move)
|
static game_state *execute_move(const game_state *from, const char *move)
|
||||||
|
Reference in New Issue
Block a user