| 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 | { |
no test coverage detected