summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-09-18 21:21:05 -0400
committera1xd <[email protected]>2021-09-23 22:36:19 -0400
commit30b54936bddf31000d6028f7deaa828c5671a48a (patch)
tree89f0489ead1821644567bf647b679879238605b4
parentupdate signed (diff)
downloadrawaccel-30b54936bddf31000d6028f7deaa828c5671a48a.tar.xz
rawaccel-30b54936bddf31000d6028f7deaa828c5671a48a.zip
fix input checks
-rw-r--r--common/rawaccel-validate.hpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/common/rawaccel-validate.hpp b/common/rawaccel-validate.hpp
index 2e892a5..4ea7936 100644
--- a/common/rawaccel-validate.hpp
+++ b/common/rawaccel-validate.hpp
@@ -53,9 +53,6 @@ namespace rawaccel {
if (args.input_offset < 0) {
error("offset can not be negative");
}
- else if (args.mode == accel_mode::jump && args.input_offset == 0) {
- error("offset can not be 0");
- }
if (args.output_offset < 0) {
error("offset can not be negative");
@@ -85,12 +82,22 @@ namespace rawaccel {
error("cap < offset");
}
- if (args.growth_rate <= 0 ||
- args.decay_rate <= 0 ||
- args.acceleration <= 0) {
+ if (args.acceleration <= 0) {
error("acceleration"" must be positive");
}
+ if (args.scale <= 0) {
+ error("scale"" must be positive");
+ }
+
+ if (args.growth_rate <= 0) {
+ error("growth rate"" must be positive");
+ }
+
+ if (args.decay_rate <= 0) {
+ error("decay rate"" must be positive");
+ }
+
if (args.motivity <= 1) {
error("motivity must be greater than 1");
}
@@ -99,10 +106,6 @@ namespace rawaccel {
error("exponent must be greater than 1");
}
- if (args.scale <= 0) {
- error("scale"" must be positive");
- }
-
if (args.exponent_power <= 0) {
error("exponent"" must be positive");
}