Changed the Switch::addChild(Node*) behavior so it doesn't override the

any pre-exisitng _values value.
This commit is contained in:
Robert Osfield 2005-02-22 10:08:01 +00:00
parent 21c8924d83
commit 64e6b79340

View File

@ -47,7 +47,17 @@ void Switch::traverse(NodeVisitor& nv)
bool Switch::addChild( Node *child )
{
return addChild(child,_newChildDefaultValue);
if (Group::addChild(child))
{
if (_children.size()>_values.size())
{
_values.resize(_children.size(),_newChildDefaultValue);
}
// note, we don't override any pre-existing _values[childPosition] setting
// like in addChild(child,value) below.
return true;
}
return false;
}
bool Switch::addChild( Node *child, bool value )