Rename get_ent_data_size/info/basetype to be more generic

This commit is contained in:
Arkshine 2015-10-09 11:32:06 +02:00
parent 68f99bc2d5
commit 02c1b20ed7
2 changed files with 16 additions and 12 deletions

View File

@ -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[]); // native get_member_size(const class[], const member[]);
static cell AMX_NATIVE_CALL get_ent_data_size(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_member_size(AMX *amx, cell *params)
{ {
CHECK_GAMERULES();
TypeDescription data; TypeDescription data;
GET_TYPE_DESCRIPTION(0, data, BaseFieldType::None, ALL); GET_TYPE_DESCRIPTION(1, data, BaseFieldType::None, ALL);
return data.fieldSize; return data.fieldSize;
} }
// 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);
static cell AMX_NATIVE_CALL find_ent_data_info(AMX *amx, cell *params) static cell AMX_NATIVE_CALL find_member_info(AMX *amx, cell *params)
{ {
CHECK_GAMERULES();
TypeDescription data; TypeDescription data;
GET_TYPE_DESCRIPTION(1, data, BaseFieldType::None, ALL); GET_TYPE_DESCRIPTION(1, data, BaseFieldType::None, ALL);
@ -786,8 +790,8 @@ AMX_NATIVE_INFO pdata_gc_natives[] =
{ "get_gamerules_string", get_gamerules_string }, { "get_gamerules_string", get_gamerules_string },
{ "set_gamerules_string", set_gamerules_string }, { "set_gamerules_string", set_gamerules_string },
{ "get_ent_data_size" , get_ent_data_size }, { "get_member_size" , get_member_size },
{ "find_ent_data_info" , find_ent_data_info }, { "find_member_info" , find_member_info },
{ nullptr , nullptr } { nullptr , nullptr }
}; };

View File

@ -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 * @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 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. * Finds an offset based off a class and member name.
@ -1010,7 +1010,7 @@ native get_ent_data_size(const class[], const member[]);
* @error If either class or member is empty, no offset is found or an invalid * @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. * 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) * @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", "none",
"integer", "integer",