]> git.mxchange.org Git - flightgear.git/commitdiff
Add the 'offset' and 'factor' arguments back into property-adjust;
authordavid <david>
Tue, 31 Dec 2002 12:08:32 +0000 (12:08 +0000)
committerdavid <david>
Tue, 31 Dec 2002 12:08:32 +0000 (12:08 +0000)
they're needed for the mouse.

src/Main/fg_commands.cxx

index b6830d09572494aad74148e670881d8e7b6fd1bd..758af5dfd2578a2839ba3d9cac736dbada8da98d 100644 (file)
@@ -404,8 +404,14 @@ do_property_assign (const SGPropertyNode * arg)
 /**
  * Built-in command: increment or decrement a property value.
  *
+ * If the 'step' argument is present, it will be used; otherwise,
+ * the command uses 'offset' and 'factor', usually from the mouse.
+ *
  * property: the name of the property to increment or decrement.
  * step: the amount of the increment or decrement (default: 0).
+ * offset: offset from the current setting (used for the mouse; multiplied 
+ *         by factor)
+ * factor: scaling amount for the offset (defaults to 1).
  * min: the minimum allowed value (default: no minimum).
  * max: the maximum allowed value (default: no maximum).
  * mask: 'integer' to apply only to the left of the decimal point, 
@@ -419,12 +425,18 @@ static bool
 do_property_adjust (const SGPropertyNode * arg)
 {
   SGPropertyNode * prop = get_prop(arg);
-  double step = arg->getDoubleValue("step");
 
+  double amount = 0;
+  if (arg->hasValue("step"))
+      amount = arg->getDoubleValue("step");
+  else
+      amount = (arg->getDoubleValue("factor", 1)
+                * arg->getDoubleValue("offset"));
+          
   double unmodifiable, modifiable;
   split_value(prop->getDoubleValue(), arg->getStringValue("mask", "all"),
               &unmodifiable, &modifiable);
-  modifiable += step;
+  modifiable += amount;
   limit_value(&modifiable, arg);
 
   prop->setDoubleValue(unmodifiable + modifiable);