From a923298d3577dca0e69fd70edbef56c7822258e3 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Fri, 17 Aug 2007 21:10:50 +0200 Subject: applied Jukka Salmi's setmwfact patch --- tile.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'tile.c') diff --git a/tile.c b/tile.c index 386832d..0955e63 100644 --- a/tile.c +++ b/tile.c @@ -9,18 +9,24 @@ static double mwfact = MWFACT; /* extern */ void -addtomwfact(const char *arg) { - double delta; +setmwfact(const char *arg) { + double delta, newfact; if(!isarrange(tile)) return; - /* arg handling, manipulate mwfact */ if(arg == NULL) mwfact = MWFACT; else if(1 == sscanf(arg, "%lf", &delta)) { - if(delta + mwfact > 0.1 && delta + mwfact < 0.9) - mwfact += delta; + if(arg[0] != '+' && arg[0] != '-') + newfact = delta; + else + newfact = mwfact + delta; + if(newfact < 0.1) + newfact = 0.1; + else if(newfact > 0.9) + newfact = 0.9; + mwfact = newfact; } arrange(); } -- cgit 1.4.1-2-gfad0