summaryrefslogtreecommitdiffhomepage
path: root/loader/scenery-traits.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'loader/scenery-traits.cpp')
-rw-r--r--loader/scenery-traits.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/loader/scenery-traits.cpp b/loader/scenery-traits.cpp
index 84cc42d9..d8add93b 100644
--- a/loader/scenery-traits.cpp
+++ b/loader/scenery-traits.cpp
@@ -11,6 +11,7 @@
#include "serialize/json-helper.hpp"
#include "serialize/anim.hpp"
#include "serialize/scenery.hpp"
+#include "serialize/json-wrapper.hpp"
#include <cr/Optional.h>
#include <Corrade/Containers/StringView.h>
@@ -18,8 +19,8 @@ namespace floormat::loader_detail {
using scenery_traits = atlas_loader_traits<scenery_proto>;
StringView scenery_traits::loader_name() { return "scenery_proto"_s; }
-auto scenery_traits::atlas_of(const Cell& x) -> const scenery_proto& { return x.proto; }
-auto scenery_traits::atlas_of(Cell& x) -> scenery_proto& { return x.proto; }
+auto scenery_traits::atlas_of(const Cell& x) -> const Optional<Atlas>& { return x.proto; }
+auto scenery_traits::atlas_of(Cell& x) -> Optional<Atlas>& { return x.proto; }
StringView scenery_traits::name_of(const Cell& x) { return x.name; }
String& scenery_traits::name_of(Cell& x) { return x.name; }
@@ -27,6 +28,7 @@ void scenery_traits::atlas_list(Storage& s)
{
fm_debug_assert(s.name_map.empty());
s.cell_array = scenery_cell::load_atlases_from_json().vec;
+ s.name_map[loader.INVALID] = -1uz;
}
auto scenery_traits::make_invalid_atlas(Storage& s) -> Cell
@@ -39,17 +41,16 @@ auto scenery_traits::make_invalid_atlas(Storage& s) -> Cell
return { .name = loader.INVALID, .proto = proto, };
}
-auto scenery_traits::make_atlas(StringView name, const Cell& c) -> scenery_proto
+auto scenery_traits::make_atlas(StringView, const Cell& c) -> Optional<scenery_proto>
{
- auto p = c.proto;
- p.atlas = loader.anim_atlas(name, loader.SCENERY_PATH);
+ scenery_proto p = c.data->j;
fm_debug_assert(p.atlas);
return p;
}
-auto scenery_traits::make_cell(StringView name) -> Optional<Cell>
+auto scenery_traits::make_cell(StringView) -> Optional<Cell>
{
- return { InPlace, Cell { .name = name, .proto = {}, } };
+ return {};
}
} // namespace floormat::loader_detail