Trying to implement more optimal access to components, not using Ensure for getters
This commit is contained in:
parent
d829acacab
commit
587b3b607d
|
@ -103,28 +103,35 @@
|
|||
|
||||
if(e.Unpack(out EcsWorld world, out int id) == false)
|
||||
throw new Exception("No entity found");
|
||||
|
||||
ref var cmp = ref world.GetPool<{{token_or(o, 'bhl_native_class', o.name)}}>().Ensure(id);
|
||||
var v = cmp.{{f.name}};
|
||||
|
||||
|
||||
{%- if token_or(f, 'bhl_set', 1) != 0 ~%}
|
||||
if(dv != null) {
|
||||
if(dv != null)
|
||||
{
|
||||
ref var cmp = ref world.GetPool<{{token_or(o, 'bhl_native_class', o.name)}}>().Ensure(id);
|
||||
{%- if f.type is instanceof('\\mtgArrType') -%}
|
||||
if(dv._obj != null && !dv._obj.Equals(v))
|
||||
if(dv._obj != null && !dv._obj.Equals(cmp.{{f.name}}))
|
||||
{%- endif ~%}
|
||||
{
|
||||
{{ bhl_bind.val2native(f.type, 'dv', 'v') }};
|
||||
cmp.{{f.name}} = v;
|
||||
{{ bhl_bind.val2native(f.type, 'dv', 'cmp.'~f.name) }};
|
||||
}
|
||||
dv.Release();
|
||||
}
|
||||
//NOTE: uncomment to disable 'dv' variable re-use
|
||||
//dv.Release();
|
||||
//dv = Val.New(frm.vm);
|
||||
//{{ bhl_bind.native2val(f.type, 'cmp.'~f.name, 'dv') }};
|
||||
}
|
||||
else
|
||||
{%- endif ~%}
|
||||
|
||||
dv = Val.New(frm.vm);
|
||||
{
|
||||
{{ bhl_bind.native2val(f.type, 'v', 'dv') }};
|
||||
}
|
||||
stack.Push(dv);
|
||||
{
|
||||
dv = Val.New(frm.vm);
|
||||
var pool = world.GetPool<{{token_or(o, 'bhl_native_class', o.name)}}>();
|
||||
if(pool.Has(id))
|
||||
{
|
||||
var v = pool.Get(id).{{f.name}};
|
||||
{{ bhl_bind.native2val(f.type, 'v', 'dv') }};
|
||||
}
|
||||
}
|
||||
stack.Push(dv);
|
||||
#endif
|
||||
return null;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue