aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2023-04-23 22:34:40 +0100
committerSimon Tatham <anakin@pobox.com>2023-04-23 22:34:40 +0100
commite080e0e3253a079ac755bb6d21ff08a6ccd96815 (patch)
treee7644c3b9d0c7661f748f681c6b7babe16e95f59
parentf01b1674bd862e1792b5216bd5d832cd52a170ae (diff)
downloadpuzzles-e080e0e3253a079ac755bb6d21ff08a6ccd96815.zip
puzzles-e080e0e3253a079ac755bb6d21ff08a6ccd96815.tar.gz
puzzles-e080e0e3253a079ac755bb6d21ff08a6ccd96815.tar.bz2
puzzles-e080e0e3253a079ac755bb6d21ff08a6ccd96815.tar.xz
Slant: actually check ui->swap_buttons.
Apparently I wrote the new-look code that sets up the prefs field in the UI, but didn't remember to rewrite the code in interpret_move that ought to read it.
-rw-r--r--slant.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/slant.c b/slant.c
index 77fec1e..14edf00 100644
--- a/slant.c
+++ b/slant.c
@@ -1716,26 +1716,12 @@ static char *interpret_move(const game_state *state, game_ui *ui,
enum { CLOCKWISE, ANTICLOCKWISE, NONE } action = NONE;
if (button == LEFT_BUTTON || button == RIGHT_BUTTON) {
- /*
- * This is an utterly awful hack which I should really sort out
- * by means of a proper configuration mechanism. One Slant
- * player has observed that they prefer the mouse buttons to
- * function exactly the opposite way round, so here's a
- * mechanism for environment-based configuration. I cache the
- * result in a global variable - yuck! - to avoid repeated
- * lookups.
- */
- {
- static int swap_buttons = -1;
- if (swap_buttons < 0)
- swap_buttons = getenv_bool("SLANT_SWAP_BUTTONS", false);
- if (swap_buttons) {
- if (button == LEFT_BUTTON)
- button = RIGHT_BUTTON;
- else
- button = LEFT_BUTTON;
- }
- }
+ if (ui->swap_buttons) {
+ if (button == LEFT_BUTTON)
+ button = RIGHT_BUTTON;
+ else
+ button = LEFT_BUTTON;
+ }
action = (button == LEFT_BUTTON) ? CLOCKWISE : ANTICLOCKWISE;
x = FROMCOORD(x);