From 77909577e4bb784115db13c91b8285d78b0345b8 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Thu, 5 Apr 2012 20:03:07 +0200 Subject: [PATCH] Error messages when installing property aliases fails. --- simgear/props/props.cxx | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/simgear/props/props.cxx b/simgear/props/props.cxx index 5fe9bc90..95b85c77 100644 --- a/simgear/props/props.cxx +++ b/simgear/props/props.cxx @@ -778,13 +778,39 @@ SGPropertyNode::~SGPropertyNode () bool SGPropertyNode::alias (SGPropertyNode * target) { - if (target == 0 || _type == props::ALIAS || _tied) - return false; - clearValue(); - get(target); - _value.alias = target; - _type = props::ALIAS; - return true; + if (target && (_type != props::ALIAS) && (!_tied)) + { + clearValue(); + get(target); + _value.alias = target; + _type = props::ALIAS; + return true; + } + +#if PROPS_STANDALONE +#else + if (!target) + { + SG_LOG(SG_GENERAL, SG_ALERT, + "Failed to create alias for " << getPath() << ". " + "The target property does not exist."); + } + else + if (_type == props::ALIAS) + { + SG_LOG(SG_GENERAL, SG_ALERT, + "Failed to create alias at " << target->getPath() << ". " + "Source "<< getPath() << " is also an alias. Unsupported recursion."); + } + else + if (_tied) + { + SG_LOG(SG_GENERAL, SG_ALERT, "Failed to create alias at " << target->getPath() << ". " + "Source " << getPath() << " is a tied property."); + } +#endif + + return false; } -- 2.39.5