summaryrefslogtreecommitdiff
path: root/common/rawaccel.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/rawaccel.hpp')
-rw-r--r--common/rawaccel.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/rawaccel.hpp b/common/rawaccel.hpp
index a40b85b..52402d5 100644
--- a/common/rawaccel.hpp
+++ b/common/rawaccel.hpp
@@ -74,7 +74,8 @@ struct accel_function {
double b = 0;
// the limit for natural and sigmoid modes,
- // or the exponent for classic mode
+ // the exponent for classic mode,
+ // or the scale factor for power mode
double k = 1;
vec2d weight = { 1, 1 };
@@ -98,7 +99,7 @@ struct accel_function {
break;
case mode::sigmoid: accel_val = k / (exp(-b * (speed - m)) + 1);
break;
- case mode::power: accel_val = pow(speed, b) - 1;
+ case mode::power: accel_val = b < 1 ? 0 : pow(speed, b*k) - 1;
break;
default:
break;
@@ -131,6 +132,7 @@ struct accel_function {
if (args.time_min <= 0) error("min time must be positive");
if (args.lim_exp <= 1) {
if (args.accel_mode == mode::classic) error("exponent must be greater than 1");
+ else if (args.accel_mode == mode::power) error("scale factor must be greater than 1");
else error("limit must be greater than 1");
}