Fixed some static_cast into dynamic_cast
This commit is contained in:
parent
aa82a332d9
commit
3e73633c25
8 changed files with 9 additions and 13 deletions
|
@ -61,8 +61,7 @@ void AtmosphereDefinition::load(PackStream *stream) {
|
|||
void AtmosphereDefinition::copy(DefinitionNode *_destination) const {
|
||||
DefinitionNode::copy(_destination);
|
||||
|
||||
AtmosphereDefinition *destination = static_cast<AtmosphereDefinition *>(_destination);
|
||||
if (destination) {
|
||||
if (auto destination = dynamic_cast<AtmosphereDefinition *>(_destination)) {
|
||||
destination->model = model;
|
||||
destination->sun_color = sun_color;
|
||||
destination->dome_lighting = dome_lighting;
|
||||
|
|
|
@ -35,8 +35,7 @@ void NoiseNode::load(PackStream *stream) {
|
|||
|
||||
void NoiseNode::copy(DefinitionNode *destination) const {
|
||||
if (destination->getTypeName() == getTypeName()) {
|
||||
auto tdestination = static_cast<NoiseNode *>(destination);
|
||||
if (tdestination) {
|
||||
if (auto tdestination = dynamic_cast<NoiseNode *>(destination)) {
|
||||
noise->copy(tdestination->noise);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -33,7 +33,7 @@ void TerrainDefinition::validate() {
|
|||
}
|
||||
|
||||
void TerrainDefinition::copy(DefinitionNode *_destination) const {
|
||||
if (auto destination = static_cast<TerrainDefinition *>(_destination)) {
|
||||
if (auto destination = dynamic_cast<TerrainDefinition *>(_destination)) {
|
||||
destination->shadow_smoothing = shadow_smoothing;
|
||||
|
||||
height_map->copy(destination->height_map);
|
||||
|
|
|
@ -43,7 +43,7 @@ void TextureLayerDefinition::validate() {
|
|||
void TextureLayerDefinition::copy(DefinitionNode *destination) const {
|
||||
DefinitionNode::copy(destination);
|
||||
|
||||
if (auto tex_destination = static_cast<TextureLayerDefinition *>(destination)) {
|
||||
if (auto tex_destination = dynamic_cast<TextureLayerDefinition *>(destination)) {
|
||||
terrain_zone->copy(tex_destination->terrain_zone);
|
||||
|
||||
*tex_destination->material = *material;
|
||||
|
|
|
@ -77,7 +77,7 @@ void WaterDefinition::load(PackStream *stream) {
|
|||
void WaterDefinition::copy(DefinitionNode *_destination) const {
|
||||
DefinitionNode::copy(_destination);
|
||||
|
||||
if (auto destination = static_cast<WaterDefinition *>(_destination)) {
|
||||
if (auto destination = dynamic_cast<WaterDefinition *>(_destination)) {
|
||||
*destination->material = *material;
|
||||
destination->transparency_depth = transparency_depth;
|
||||
destination->transparency = transparency;
|
||||
|
|
|
@ -38,7 +38,7 @@ void Zone::load(PackStream *stream) {
|
|||
}
|
||||
|
||||
void Zone::copy(DefinitionNode *_destination) const {
|
||||
if (auto destination = static_cast<Zone *>(_destination)) {
|
||||
if (auto destination = dynamic_cast<Zone *>(_destination)) {
|
||||
destination->absolute_height = absolute_height;
|
||||
destination->relative_height_min = relative_height_min;
|
||||
destination->relative_height_middle = relative_height_middle;
|
||||
|
|
|
@ -32,8 +32,7 @@ void BaseModelerTool::destroy() {
|
|||
}
|
||||
|
||||
void BaseModelerTool::addIntBinding(const string &object, const string &property, const string &path, bool monitor) {
|
||||
auto node = static_cast<IntNode *>(ui->getScenery()->findByPath(path));
|
||||
if (node) {
|
||||
if (auto node = dynamic_cast<IntNode *>(ui->getScenery()->findByPath(path))) {
|
||||
impl->int_bindings.push_back(make_unique<IntPropertyBind>(ui, object, property, node));
|
||||
|
||||
if (monitor) {
|
||||
|
@ -45,8 +44,7 @@ void BaseModelerTool::addIntBinding(const string &object, const string &property
|
|||
}
|
||||
|
||||
void BaseModelerTool::addFloatBinding(const string &object, const string &property, const string &path, bool monitor) {
|
||||
auto node = static_cast<FloatNode *>(ui->getScenery()->findByPath(path));
|
||||
if (node) {
|
||||
if (auto node = dynamic_cast<FloatNode *>(ui->getScenery()->findByPath(path))) {
|
||||
impl->float_bindings.push_back(make_unique<FloatPropertyBind>(ui, object, property, node));
|
||||
|
||||
if (monitor) {
|
||||
|
|
|
@ -25,7 +25,7 @@ MoonRenderer::~MoonRenderer() {
|
|||
}
|
||||
|
||||
void MoonRenderer::nodeChanged(const DefinitionNode *, const DefinitionDiff *, const DefinitionNode *parent) {
|
||||
if (auto moon_node = static_cast<const CelestialBodyDefinition *>(parent)) {
|
||||
if (auto moon_node = dynamic_cast<const CelestialBodyDefinition *>(parent)) {
|
||||
moon_node->copy(&impl->definition);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue