diff options
-rw-r--r-- | source/game/StarItem.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/game/StarItem.cpp b/source/game/StarItem.cpp index 3658bb0..f920a64 100644 --- a/source/game/StarItem.cpp +++ b/source/game/StarItem.cpp @@ -25,9 +25,13 @@ Item::Item(Json config, String directory, Json parameters) { if (inventoryIcon.type() == Json::Type::Array) { List<Drawable> iconDrawables; for (auto const& drawable : inventoryIcon.toArray()) { - auto image = AssetPath::relativeTo(m_directory, drawable.getString("image")); - Vec2F position = jsonToVec2F(drawable.getArray("position", {0, 0})); - iconDrawables.append(Drawable::makeImage(image, 1.0f, true, position)); + if (auto image = drawable.optString("image")) { + auto changed = drawable.set("image", AssetPath::relativeTo(m_directory, *image)); + iconDrawables.emplaceAppend(changed); + } + else { + iconDrawables.emplaceAppend(drawable); + } } setIconDrawables(move(iconDrawables)); } else { |