From: Torsten Dreyer Date: Sat, 12 Feb 2011 13:46:58 +0000 (+0100) Subject: Fix initial value for tied read-only properties X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3a620fe55d76c0704e91b12112105d04bcff85cf;p=simgear.git Fix initial value for tied read-only properties --- diff --git a/simgear/props/props.cxx b/simgear/props/props.cxx index fce6e8ab..12a8fe83 100644 --- a/simgear/props/props.cxx +++ b/simgear/props/props.cxx @@ -1615,8 +1615,12 @@ bool SGPropertyNode::tie (const SGRawValue &rawValue, _tied = true; _value.val = rawValue.clone(); - if (useDefault) + if (useDefault) { + int save_attributes = getAttributes(); + setAttribute( WRITE, true ); setStringValue(old_val.c_str()); + setAttributes( save_attributes ); + } return true; } diff --git a/simgear/props/props.hxx b/simgear/props/props.hxx index a80fc10a..e870f440 100644 --- a/simgear/props/props.hxx +++ b/simgear/props/props.hxx @@ -1786,8 +1786,12 @@ bool SGPropertyNode::tie(const SGRawValue &rawValue, bool useDefault) _type = EXTENDED; _tied = true; _value.val = rawValue.clone(); - if (useDefault) + if (useDefault) { + int save_attributes = getAttributes(); + setAttribute( WRITE, true ); setValue(old_val); + setAttributes( save_attributes ); + } return true; }