X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/1f51811e853cd0e1b6dbf413c05c617b6db818c2..0b119fd7d6d58c9cb8210477fa8c4573744c69d8:/net.c diff --git a/net.c b/net.c index 0d51443..3c8a660 100644 --- a/net.c +++ b/net.c @@ -232,7 +232,7 @@ static void decode_params(game_params *ret, char const *string) ret->wrapping = TRUE; } else if (*p == 'b') { p++; - ret->barrier_probability = atof(p); + ret->barrier_probability = (float)atof(p); while (*p && (*p == '.' || isdigit((unsigned char)*p))) p++; } else if (*p == 'a') { p++; @@ -1782,6 +1782,11 @@ static char *solve_game(game_state *state, game_state *currstate, return ret; } +static int game_can_format_as_text_now(game_params *params) +{ + return TRUE; +} + static char *game_text_format(game_state *state) { return NULL; @@ -1973,7 +1978,11 @@ static char *interpret_move(game_state *state, game_ui *ui, * Middle button never drags: it only toggles the lock. */ action = TOGGLE_LOCK; - } else if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { + } else if (button == LEFT_BUTTON +#ifndef STYLUS_BASED + || button == RIGHT_BUTTON /* (see above) */ +#endif + ) { /* * Otherwise, we note down the start point for a drag. */ @@ -1983,7 +1992,11 @@ static char *interpret_move(game_state *state, game_ui *ui, ui->dragstarty = y % TILE_SIZE; ui->dragged = FALSE; return nullret; /* no actual action */ - } else if (button == LEFT_DRAG || button == RIGHT_DRAG) { + } else if (button == LEFT_DRAG +#ifndef STYLUS_BASED + || button == RIGHT_DRAG +#endif + ) { /* * Find the new drag point and see if it necessitates a * rotation. @@ -2032,7 +2045,11 @@ static char *interpret_move(game_state *state, game_ui *ui, ui->dragstarty = yC; ui->dragged = TRUE; } - } else if (button == LEFT_RELEASE || button == RIGHT_RELEASE) { + } else if (button == LEFT_RELEASE +#ifndef STYLUS_BASED + || button == RIGHT_RELEASE +#endif + ) { if (!ui->dragged) { /* * There was a click but no perceptible drag: @@ -2056,8 +2073,7 @@ static char *interpret_move(game_state *state, game_ui *ui, #endif /* USE_DRAGGING */ - } else if (button == CURSOR_UP || button == CURSOR_DOWN || - button == CURSOR_RIGHT || button == CURSOR_LEFT) { + } else if (IS_CURSOR_MOVE(button)) { switch (button) { case CURSOR_UP: dir = U; break; case CURSOR_DOWN: dir = D; break; @@ -2072,12 +2088,12 @@ static char *interpret_move(game_state *state, game_ui *ui, } else if (button == 'a' || button == 's' || button == 'd' || button == 'A' || button == 'S' || button == 'D' || button == 'f' || button == 'F' || - button == CURSOR_SELECT) { + IS_CURSOR_SELECT(button)) { tx = ui->cur_x; ty = ui->cur_y; if (button == 'a' || button == 'A' || button == CURSOR_SELECT) action = ROTATE_LEFT; - else if (button == 's' || button == 'S') + else if (button == 's' || button == 'S' || button == CURSOR_SELECT2) action = TOGGLE_LOCK; else if (button == 'd' || button == 'D') action = ROTATE_RIGHT; @@ -2858,8 +2874,8 @@ static void game_print_size(game_params *params, float *x, float *y) * I'll use 8mm squares by default. */ game_compute_size(params, 800, &pw, &ph); - *x = pw / 100.0; - *y = ph / 100.0; + *x = pw / 100.0F; + *y = ph / 100.0F; } static void draw_diagram(drawing *dr, game_drawstate *ds, int x, int y, @@ -3005,7 +3021,7 @@ const struct game thegame = { dup_game, free_game, TRUE, solve_game, - FALSE, game_text_format, + FALSE, game_can_format_as_text_now, game_text_format, new_ui, free_ui, encode_ui,