From 02c1b20ed7631afff34d9438fb6347f1373b2fca Mon Sep 17 00:00:00 2001 From: Arkshine Date: Fri, 9 Oct 2015 11:32:06 +0200 Subject: [PATCH] Rename get_ent_data_size/info/basetype to be more generic --- modules/fakemeta/pdata_gc.cpp | 18 +++++++++++------- plugins/include/fakemeta.inc | 10 +++++----- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/fakemeta/pdata_gc.cpp b/modules/fakemeta/pdata_gc.cpp index 7089ff6d..ba25086e 100644 --- a/modules/fakemeta/pdata_gc.cpp +++ b/modules/fakemeta/pdata_gc.cpp @@ -739,18 +739,22 @@ static cell AMX_NATIVE_CALL set_gamerules_string(AMX *amx, cell *params) -// native get_ent_data_size(const class[], const member[]); -static cell AMX_NATIVE_CALL get_ent_data_size(AMX *amx, cell *params) +// native get_member_size(const class[], const member[]); +static cell AMX_NATIVE_CALL get_member_size(AMX *amx, cell *params) { + CHECK_GAMERULES(); + TypeDescription data; - GET_TYPE_DESCRIPTION(0, data, BaseFieldType::None, ALL); + GET_TYPE_DESCRIPTION(1, data, BaseFieldType::None, ALL); return data.fieldSize; } -// native find_ent_data_info(const class[], const member[], &FieldType:type = FIELD_NONE, &arraysize = 0, &bool:unsigned = false); -static cell AMX_NATIVE_CALL find_ent_data_info(AMX *amx, cell *params) +// native find_member_info(const class[], const member[], &FieldType:type = FIELD_NONE, &arraysize = 0, &bool:unsigned = false); +static cell AMX_NATIVE_CALL find_member_info(AMX *amx, cell *params) { + CHECK_GAMERULES(); + TypeDescription data; GET_TYPE_DESCRIPTION(1, data, BaseFieldType::None, ALL); @@ -786,8 +790,8 @@ AMX_NATIVE_INFO pdata_gc_natives[] = { "get_gamerules_string", get_gamerules_string }, { "set_gamerules_string", set_gamerules_string }, - { "get_ent_data_size" , get_ent_data_size }, - { "find_ent_data_info" , find_ent_data_info }, + { "get_member_size" , get_member_size }, + { "find_member_info" , find_member_info }, { nullptr , nullptr } }; diff --git a/plugins/include/fakemeta.inc b/plugins/include/fakemeta.inc index a8183ceb..ce29dc8f 100755 --- a/plugins/include/fakemeta.inc +++ b/plugins/include/fakemeta.inc @@ -995,7 +995,7 @@ native set_gamerules_string(const class[], const member[], const value[], elemen * @error If either class or member is empty, no offset is found or an invalid * offset is retrieved, an error will be thrown. */ -native get_ent_data_size(const class[], const member[]); +native get_member_size(const class[], const member[]); /** * Finds an offset based off a class and member name. @@ -1008,9 +1008,9 @@ native get_ent_data_size(const class[], const member[]); * * @return Class member offset * @error If either class or member is empty, no offset is found or an invalid - * offset is retrieved, an error will be thrown. + * offset is retrieved, an error will be thrown. */ -native find_ent_data_info(const class[], const member[], &FieldType:type = FIELD_NONE, &arraysize = 0, &bool:unsigned = false); +native find_member_info(const class[], const member[], &FieldType:type = FIELD_NONE, &arraysize = 0, &bool:unsigned = false); /** * Returns the data field base type based off a specific field type. @@ -1025,9 +1025,9 @@ native find_ent_data_info(const class[], const member[], &FieldType:type = FIELD * * @return Base field type (BASEFIELD_* constants) */ -stock BaseFieldType:get_ent_data_basetype(FieldType:type, type_name[] = "", maxlen = 0) +stock BaseFieldType:get_field_basetype(FieldType:type, type_name[] = "", maxlen = 0) { - static baseFieldTypeNames[BaseFieldType][] = + static const baseFieldTypeNames[BaseFieldType][] = { "none", "integer",