From ea6448c9565c3e726ac0c59da24630a61a5c16a1 Mon Sep 17 00:00:00 2001
From: david <david>
Date: Tue, 31 Dec 2002 03:05:38 +0000
Subject: [PATCH] Modify the property-assign command to optionally copy a value
 from another property (suggested by Jim Wilson).

---
 src/Main/fg_commands.cxx | 34 +++++++++-------------------------
 1 file changed, 9 insertions(+), 25 deletions(-)

diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx
index fa5228790..b6830d095 100644
--- a/src/Main/fg_commands.cxx
+++ b/src/Main/fg_commands.cxx
@@ -382,38 +382,22 @@ do_property_toggle (const SGPropertyNode * arg)
  * Built-in command: assign a value to a property.
  *
  * property: the name of the property to assign.
- * value: the value to assign.
+ * value: the value to assign; or
+ * property[1]: the property to copy from.
  */
 static bool
 do_property_assign (const SGPropertyNode * arg)
 {
   SGPropertyNode * prop = get_prop(arg);
+  const SGPropertyNode * prop2 = get_prop2(arg);
   const SGPropertyNode * value = arg->getNode("value");
 
-  switch (prop->getType()) {
-
-  case SGPropertyNode::BOOL:
-    return prop->setBoolValue(value->getBoolValue());
-
-  case SGPropertyNode::INT:
-    return prop->setIntValue(value->getIntValue());
-
-  case SGPropertyNode::LONG:
-    return prop->setLongValue(value->getLongValue());
-
-  case SGPropertyNode::FLOAT:
-    return prop->setFloatValue(value->getFloatValue());
-
-  case SGPropertyNode::DOUBLE:
-    return prop->setDoubleValue(value->getDoubleValue());
-
-  case SGPropertyNode::STRING:
-    return prop->setStringValue(value->getStringValue());
-
-  default:
-    return prop->setUnspecifiedValue(value->getStringValue());
-
-  }
+  if (value != 0)
+      return prop->setUnspecifiedValue(value->getStringValue());
+  else if (prop2)
+      return prop->setUnspecifiedValue(prop2->getStringValue());
+  else
+      return false;
 }