meta: improve cursor api
Allow more types to be set with ecs_meta_set_(u)int()
Allow fields to be set to NULL with integers
@@ -450,7 +450,8 @@ case kind:\
case_T(EcsOpI16, ecs_i16_t, dst, src);\
case_T(EcsOpI32, ecs_i32_t, dst, src);\
case_T(EcsOpI64, ecs_i64_t, dst, src);\
- case_T(EcsOpIPtr, ecs_iptr_t, dst, src)
+ case_T(EcsOpIPtr, ecs_iptr_t, dst, src);\
+ case_T(EcsOpEnum, ecs_i32_t, dst, src);\
#define cases_T_unsigned(dst, src)\
case_T(EcsOpByte, ecs_byte_t, dst, src);\
@@ -459,6 +460,8 @@ case kind:\
case_T(EcsOpU32, ecs_u32_t, dst, src);\
case_T(EcsOpU64, ecs_u64_t, dst, src);\
case_T(EcsOpUPtr, ecs_uptr_t, dst, src);\
+ case_T(EcsOpEntity, ecs_u64_t, dst, src);\
+ case_T(EcsOpBitmask, ecs_u32_t, dst, src);\
#define cases_T_bool(dst, src)\
case EcsOpBool:\
@@ -525,8 +528,10 @@ int ecs_meta_set_int(
switch(op->kind) {
cases_T_bool(ptr, value);
cases_T_signed(ptr, value);
+ cases_T_unsigned(ptr, value);
cases_T_float(ptr, value);
default: {
+ if(!value) return ecs_meta_set_null(cursor);
conversion_error(cursor, op, "int");
return -1;
}
@@ -545,12 +550,11 @@ int ecs_meta_set_uint(
switch(op->kind) {
cases_T_bool(ptr, value);
+ cases_T_signed(ptr, value);
cases_T_unsigned(ptr, value);
cases_T_float(ptr, value);
- case EcsOpEntity:
- set_T(ecs_entity_t, ptr, value);
- break;
default:
+ if(!value) return ecs_meta_set_null(cursor);
conversion_error(cursor, op, "uint");
return -1;
}
