| 127 | } |
| 128 | |
| 129 | s32 compile(CompileOptions &opts) |
| 130 | { |
| 131 | TempAllocator4096 ta; |
| 132 | JsonObject obj(ta); |
| 133 | JsonArray texture(ta); |
| 134 | JsonArray script(ta); |
| 135 | JsonArray sound(ta); |
| 136 | JsonArray mesh(ta); |
| 137 | JsonArray unit(ta); |
| 138 | JsonArray sprite(ta); |
| 139 | JsonArray material(ta); |
| 140 | JsonArray font(ta); |
| 141 | JsonArray level(ta); |
| 142 | JsonArray phyconf(ta); |
| 143 | JsonArray shader(ta); |
| 144 | JsonArray sprite_animation(ta); |
| 145 | JsonArray render_config(ta); |
| 146 | |
| 147 | Array<ResourceOffset> resources(default_allocator()); |
| 148 | HashSet<ResourceOffset> resources_set(default_allocator()); |
| 149 | |
| 150 | Buffer buf = opts.read(); |
| 151 | RETURN_IF_ERROR(sjson::parse(obj, buf)); |
| 152 | |
| 153 | if (json_object::has(obj, "texture")) { |
| 154 | RETURN_IF_ERROR(sjson::parse_array(texture, obj["texture"])); |
| 155 | } |
| 156 | if (json_object::has(obj, "lua")) { |
| 157 | RETURN_IF_ERROR(sjson::parse_array(script, obj["lua"])); |
| 158 | } |
| 159 | if (json_object::has(obj, "sound")) { |
| 160 | RETURN_IF_ERROR(sjson::parse_array(sound, obj["sound"])); |
| 161 | } |
| 162 | if (json_object::has(obj, "mesh")) { |
| 163 | RETURN_IF_ERROR(sjson::parse_array(mesh, obj["mesh"])); |
| 164 | } |
| 165 | if (json_object::has(obj, "unit")) { |
| 166 | RETURN_IF_ERROR(sjson::parse_array(unit, obj["unit"])); |
| 167 | } |
| 168 | if (json_object::has(obj, "sprite")) { |
| 169 | RETURN_IF_ERROR(sjson::parse_array(sprite, obj["sprite"])); |
| 170 | } |
| 171 | if (json_object::has(obj, "material")) { |
| 172 | RETURN_IF_ERROR(sjson::parse_array(material, obj["material"])); |
| 173 | } |
| 174 | if (json_object::has(obj, "font")) { |
| 175 | RETURN_IF_ERROR(sjson::parse_array(font, obj["font"])); |
| 176 | } |
| 177 | if (json_object::has(obj, "level")) { |
| 178 | RETURN_IF_ERROR(sjson::parse_array(level, obj["level"])); |
| 179 | } |
| 180 | if (json_object::has(obj, "physics_config")) { |
| 181 | RETURN_IF_ERROR(sjson::parse_array(phyconf, obj["physics_config"])); |
| 182 | } |
| 183 | if (json_object::has(obj, "shader")) { |
| 184 | RETURN_IF_ERROR(sjson::parse_array(shader, obj["shader"])); |
| 185 | } |
| 186 | if (json_object::has(obj, "sprite_animation")) { |
nothing calls this directly
no test coverage detected