MCPcopy Create free account
hub / github.com/crownengine/crown / object_index

Function object_index

src/resource/unit_compiler.cpp:634–655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

632 }
633
634 u32 object_index(const JsonArray &objects, const Guid &object_id, CompileOptions &opts)
635 {
636 CE_UNUSED(opts);
637
638 for (u32 i = 0; i < array::size(objects); ++i) {
639 TempAllocator512 ta;
640 JsonObject obj(ta);
641 RETURN_IF_ERROR(sjson::parse(obj, objects[i]));
642
643 if (json_object::has(obj, "id")) {
644 Guid id = RETURN_IF_ERROR(sjson::parse_guid(obj["id"]));
645 if (id == object_id)
646 return i;
647 } else {
648 Guid id = RETURN_IF_ERROR(sjson::parse_guid(obj["_guid"]));
649 if (id == object_id)
650 return i;
651 }
652 }
653
654 return UINT32_MAX;
655 }
656
657 Unit *find_children(Unit *unit, Guid id)
658 {

Callers 1

modify_unit_componentsFunction · 0.85

Calls 4

parse_guidFunction · 0.85
parseFunction · 0.70
sizeFunction · 0.50
hasFunction · 0.50

Tested by

no test coverage detected