Fix (get/set)_pdata_(int/float) using the wrong offset value (typo from #297)

This commit is contained in:
Arkshine 2015-10-09 20:30:45 +02:00
parent cae7281def
commit 9997c31703

View File

@ -58,7 +58,7 @@ static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params)
iOffset += params[5]; iOffset += params[5];
#endif #endif
int iValue=params[3]; int iValue=params[3];
set_pdata<int>(TypeConversion.id_to_edict(index), iOffset, iValue); set_pdata<int>(TypeConversion.id_to_edict(index), iOffset * 4, iValue); // *4 because macro is char-based, while native is int-based
return 1; return 1;
} }
@ -80,7 +80,7 @@ static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params)
iOffset += params[4]; iOffset += params[4];
#endif #endif
return get_pdata<int>(TypeConversion.id_to_edict(index), iOffset); return get_pdata<int>(TypeConversion.id_to_edict(index), iOffset * 4); // *4 because macro is char-based, while native is int-based
} }
// Float // Float
@ -103,7 +103,7 @@ static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params)
#endif #endif
float fValue=amx_ctof(params[3]); float fValue=amx_ctof(params[3]);
set_pdata<float>(TypeConversion.id_to_edict(index), iOffset, fValue); set_pdata<float>(TypeConversion.id_to_edict(index), iOffset * 4, fValue); // *4 because macro is char-based, while native is int-based
return 1; return 1;
} }
static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
@ -124,7 +124,7 @@ static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
iOffset += params[4]; iOffset += params[4];
#endif #endif
return amx_ftoc(get_pdata<float>(TypeConversion.id_to_edict(index), iOffset)); return amx_ftoc(get_pdata<float>(TypeConversion.id_to_edict(index), iOffset * 4)); // *4 because macro is char-based, while native is int-based
} }
static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params)