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

Function compile_script

src/resource/unit_compiler.cpp:403–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401}
402
403static s32 compile_script(Buffer &output, UnitCompiler &compiler, FlatJsonObject &obj, CompileOptions &opts)
404{
405 CE_UNUSED(compiler);
406
407 TempAllocator4096 ta;
408 DynamicString script_resource(ta);
409 RETURN_IF_ERROR(sjson::parse_string(script_resource, flat_json_object::get(obj, "data.script_resource")));
410 RETURN_IF_MISSING(UNIT_COMPILER, "lua"
411 , script_resource.c_str()
412 , opts
413 );
414 opts.add_requirement("lua", script_resource.c_str());
415
416 ScriptDesc sd;
417 sd.script_resource = RETURN_IF_ERROR(sjson::parse_resource_name(flat_json_object::get(obj, "data.script_resource")));
418 strcpy(sd.script_resource_name, script_resource.c_str());
419
420 FileBuffer fb(output);
421 BinaryWriter bw(fb);
422 bw.write(sd.script_resource);
423 bw.write(sd.script_resource_name);
424 return 0;
425}
426
427static s32 compile_animation_state_machine(Buffer &output, UnitCompiler &compiler, FlatJsonObject &obj, CompileOptions &opts)
428{

Callers

nothing calls this directly

Calls 7

getFunction · 0.85
parse_resource_nameFunction · 0.85
strcpyFunction · 0.85
add_requirementMethod · 0.80
parse_stringFunction · 0.50
c_strMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected