Skip to content

Commit

Permalink
[#90] feat(VirtualObject): add default visual so that `VirtualObject:…
Browse files Browse the repository at this point in the history
…:visual` is never `nullptr`
  • Loading branch information
lmichaelis committed Jun 9, 2024
1 parent ac9b8e3 commit 18318ec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vobs/VirtualObject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <unordered_map>

namespace zenkit {
static std::shared_ptr<Visual> const DEFAULT_VISUAL = std::make_shared<Visual>();

/// \brief A mapping of archive class names to visual_type values.
static std::unordered_map<ObjectType, VisualType> visual_type_map = {
{ObjectType::zCDecal, VisualType::DECAL},
Expand Down Expand Up @@ -167,6 +169,8 @@ namespace zenkit {
if (this->visual->type == VisualType::DECAL) {
this->visual_decal.emplace(*reinterpret_cast<VisualDecal*>(this->visual.get()));
}
} else {
this->visual = DEFAULT_VISUAL;
}
}

Expand Down

0 comments on commit 18318ec

Please sign in to comment.