Fixed addChild(node,value) so that it resizes using the _newChildDefaultValue

rather than the add child value, then sets the child's value to value.
This commit is contained in:
Robert Osfield 2002-10-30 10:07:16 +00:00
parent 32c6a7809a
commit 8a9fce09d8

View File

@ -45,10 +45,15 @@ bool Switch::addChild( Node *child )
bool Switch::addChild( Node *child, bool value ) bool Switch::addChild( Node *child, bool value )
{ {
unsigned int childPosition = _children.size();
if (Group::addChild(child)) if (Group::addChild(child))
{ {
if (_children.size()>_values.size()) _values.resize(_children.size(),value); if (_children.size()>_values.size())
return true; {
_values.resize(_children.size(),_newChildDefaultValue);
_values[childPosition]=value;
}
return true;
} }
return false; return false;
} }