Fixed layers not adding children to BaseDefinition

This commit is contained in:
Michaël Lemaire 2013-12-15 15:33:54 +01:00
parent bd29ee97cf
commit cc9c68bef9
4 changed files with 9 additions and 4 deletions

View file

@ -74,7 +74,7 @@ void BaseDefinition::validate()
void BaseDefinition::addChild(BaseDefinition* child)
{
if (std::find(children.begin(), children.end(), child) != children.end())
if (std::find(children.begin(), children.end(), child) == children.end())
{
children.push_back(child);
child->parent = this;
@ -91,6 +91,6 @@ void BaseDefinition::removeChild(BaseDefinition* child)
}
else
{
qWarning("Trying to remove not found child from '%s'", name.c_str());
qWarning("Trying to remove not found child '%s' from '%s'", child->name.c_str(), name.c_str());
}
}

View file

@ -10,6 +10,7 @@ static BaseDefinition* _layerConstructor(Layers* parent)
CloudsDefinition::CloudsDefinition(BaseDefinition* parent):
Layers(parent, _layerConstructor)
{
setName("clouds");
}
void CloudsDefinition::applyPreset(CloudsPreset preset)

View file

@ -75,7 +75,7 @@ int Layers::findLayer(BaseDefinition* layer) const
}
i++;
}
qWarning("Layer %p not found, on a total of %d, returning %d", layer, (int)layers.size(), -1);
qWarning("Layer %p (%s) not found, on a total of %d", layer, layer->getName().c_str(), (int)layers.size());
return -1;
}
@ -108,6 +108,10 @@ void Layers::removeLayer(int position)
layers.erase(layers.begin() + position);
delete removed;
}
else
{
qWarning("Removing unknown layer %d on %d from '%s'", position, (int)layers.size(), getName().c_str());
}
}
void Layers::removeLayer(BaseDefinition* layer)

View file

@ -101,7 +101,7 @@ void WaterAspectPreviewRenderer::choiceChangeEvent(const std::string &key, int p
}
}
double WaterAspectPreviewRenderer::getPrecision(const Vector3 &location)
double WaterAspectPreviewRenderer::getPrecision(const Vector3 &)
{
return 0.000001;
}