diff --git a/src/definition/BaseDefinition.cpp b/src/definition/BaseDefinition.cpp index 6aa1c6f..f03014a 100644 --- a/src/definition/BaseDefinition.cpp +++ b/src/definition/BaseDefinition.cpp @@ -24,7 +24,7 @@ BaseDefinition::~BaseDefinition() } } -void BaseDefinition::setName(QString name) +void BaseDefinition::setName(const QString &name) { this->name = name; } diff --git a/src/definition/BaseDefinition.h b/src/definition/BaseDefinition.h index ddf9fd0..527eace 100644 --- a/src/definition/BaseDefinition.h +++ b/src/definition/BaseDefinition.h @@ -26,7 +26,7 @@ public: virtual void validate(); inline const QString& getName() const {return name;} - virtual void setName(QString name); + virtual void setName(const QString &name); virtual Scenery* getScenery(); diff --git a/src/definition/CloudLayerDefinition.cpp b/src/definition/CloudLayerDefinition.cpp index 0ea5336..9f5d115 100644 --- a/src/definition/CloudLayerDefinition.cpp +++ b/src/definition/CloudLayerDefinition.cpp @@ -40,6 +40,8 @@ CloudLayerDefinition* CloudLayerDefinition::newCopy(BaseDefinition* parent) cons void CloudLayerDefinition::save(PackStream* stream) const { + BaseDefinition::save(stream); + int clouds_type = (int)type; stream->write(&clouds_type); @@ -62,6 +64,8 @@ void CloudLayerDefinition::save(PackStream* stream) const void CloudLayerDefinition::load(PackStream* stream) { + BaseDefinition::load(stream); + int clouds_type; stream->read(&clouds_type); @@ -87,6 +91,8 @@ void CloudLayerDefinition::load(PackStream* stream) void CloudLayerDefinition::copy(BaseDefinition* _destination) const { + BaseDefinition::copy(_destination); + CloudLayerDefinition* destination = (CloudLayerDefinition*)_destination; destination->type = type; diff --git a/src/definition/CloudsDefinition.cpp b/src/definition/CloudsDefinition.cpp index 12d146e..e176cb5 100644 --- a/src/definition/CloudsDefinition.cpp +++ b/src/definition/CloudsDefinition.cpp @@ -20,6 +20,7 @@ void CloudsDefinition::applyPreset(CloudsPreset preset) { CloudLayerDefinition* layer = new CloudLayerDefinition(this); layer->applyPreset(CloudLayerDefinition::CLOUDS_LAYER_PRESET_CIRRUS); + layer->setName("Cirrus"); addLayer(layer); } } diff --git a/src/definition/Layers.cpp b/src/definition/Layers.cpp index 625fc42..0aad58d 100644 --- a/src/definition/Layers.cpp +++ b/src/definition/Layers.cpp @@ -15,10 +15,9 @@ Layers::~Layers() void Layers::copy(BaseDefinition* destination_) const { - Layers* destination = (Layers*)destination_; + BaseDefinition::copy(destination_); - // don't call overridden method, it will copy again the children - // FIXME ... but the definition name (and other future attributes) is not copied + Layers* destination = (Layers*)destination_; destination->clear(); diff --git a/src/definition/TextureLayerDefinition.cpp b/src/definition/TextureLayerDefinition.cpp index 562d92c..689dfe9 100644 --- a/src/definition/TextureLayerDefinition.cpp +++ b/src/definition/TextureLayerDefinition.cpp @@ -26,6 +26,8 @@ TextureLayerDefinition::~TextureLayerDefinition() void TextureLayerDefinition::validate() { + BaseDefinition::validate(); + if (displacement_scaling < 0.000001) { displacement_scaling = 0.000001; @@ -55,6 +57,8 @@ void TextureLayerDefinition::validate() void TextureLayerDefinition::copy(BaseDefinition *_destination) const { + BaseDefinition::copy(_destination); + TextureLayerDefinition* destination = (TextureLayerDefinition*)_destination; terrain_zone->copy(destination->terrain_zone); @@ -70,6 +74,8 @@ void TextureLayerDefinition::copy(BaseDefinition *_destination) const void TextureLayerDefinition::save(PackStream* stream) const { + BaseDefinition::save(stream); + terrain_zone->save(stream); stream->write(&displacement_scaling); stream->write(&displacement_height); @@ -82,6 +88,8 @@ void TextureLayerDefinition::save(PackStream* stream) const void TextureLayerDefinition::load(PackStream* stream) { + BaseDefinition::load(stream); + terrain_zone->load(stream); stream->read(&displacement_scaling); stream->read(&displacement_height);