Comply to AMXX style for more consistency in 47c47df488e8

This commit is contained in:
Vincent Herbet 2013-07-02 23:31:27 +02:00
parent 1722d0cb4f
commit f9deb552af
2 changed files with 112 additions and 112 deletions

View File

@ -239,267 +239,267 @@ static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params)
return ent;
}
static cell AMX_NATIVE_CALL set_pdata_ent( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL set_pdata_ent(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
int entity = params[3];
CHECK_ENTITY( entity );
CHECK_ENTITY(entity);
#if defined( __linux__ )
#if defined(__linux__)
offset += params[4];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 4 )
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
*( edict_t** )( ( char* )( INDEXENT2( index )->pvPrivateData ) + offset ) = INDEXENT2( entity );
*(edict_t **)((char *)(INDEXENT2(index)->pvPrivateData) + offset) = INDEXENT2(entity);
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_bool( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL get_pdata_bool(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
#if defined( __linux__ )
#if defined(__linux__)
offset += params[3];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 3 )
if (params[0] / sizeof(cell) == 3)
offset += params[3];
else
offset += params[4];
#endif
return *( bool* )( ( char* )INDEXENT2( index )->pvPrivateData + offset ) ? TRUE : FALSE;
return *(bool *)((char *)INDEXENT2(index)->pvPrivateData + offset) ? TRUE : FALSE;
}
static cell AMX_NATIVE_CALL set_pdata_bool( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL set_pdata_bool(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
bool value = params[3] ? true : false;
#if defined( __linux__ )
#if defined(__linux__)
offset += params[4];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 4 )
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
*( bool* )( ( char* )INDEXENT2( index )->pvPrivateData + offset ) = value;
*(bool *)((char *)INDEXENT2(index)->pvPrivateData + offset) = value;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_byte( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL get_pdata_byte(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
#if defined( __linux__ )
#if defined(__linux__)
offset += params[3];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 3 )
if (params[0] / sizeof(cell) == 3)
offset += params[3];
else
offset += params[4];
#endif
return static_cast< cell >( *( ( byte* )INDEXENT2( index )->pvPrivateData + offset ) );
return static_cast<cell>(*((byte *)INDEXENT2(index)->pvPrivateData + offset));
}
static cell AMX_NATIVE_CALL set_pdata_byte( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL set_pdata_byte(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
byte value = static_cast< byte >( params[3] );
byte value = static_cast<byte>(params[3]);
#if defined( __linux__ )
#if defined(__linux__)
offset += params[4];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 4 )
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
*( ( byte* )INDEXENT2( index )->pvPrivateData + offset ) = value;
*((byte *)INDEXENT2(index)->pvPrivateData + offset) = value;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_short( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL get_pdata_short(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
#if defined( __linux__ )
#if defined(__linux__)
offset += params[3];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 3 )
if (params[0] / sizeof(cell) == 3)
offset += params[3];
else
offset += params[4];
#endif
return static_cast< cell >( *( short* )( ( char* )INDEXENT2( index )->pvPrivateData + offset ) );
return static_cast<cell>(*(short *)((char *)INDEXENT2(index)->pvPrivateData + offset));
}
static cell AMX_NATIVE_CALL set_pdata_short( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL set_pdata_short(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
short value = static_cast< short >( params[3] );
short value = static_cast<short>(params[3]);
#if defined( __linux__ )
#if defined(__linux__)
offset += params[4];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 4 )
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
*( short* )( ( char* )INDEXENT2( index )->pvPrivateData + offset ) = value;
*(short *)((char *)INDEXENT2(index)->pvPrivateData + offset) = value;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_vector( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL get_pdata_vector(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
#if defined( __linux__ )
#if defined(__linux__)
offset += params[4];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 4 )
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
cell *cpvec = MF_GetAmxAddr( amx, params[3] );
cell *cpvec = MF_GetAmxAddr(amx, params[3]);
Vector vec = *( Vector* )( ( char* )INDEXENT2( index )->pvPrivateData + offset );
Vector vec = *(Vector *)((char *)INDEXENT2(index)->pvPrivateData + offset);
cpvec[0] = amx_ftoc( vec.x );
cpvec[1] = amx_ftoc( vec.y );
cpvec[2] = amx_ftoc( vec.z );
cpvec[0] = amx_ftoc(vec.x);
cpvec[1] = amx_ftoc(vec.y);
cpvec[2] = amx_ftoc(vec.z);
return 1;
}
static cell AMX_NATIVE_CALL set_pdata_vector( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
#if defined( __linux__ )
#if defined(__linux__)
offset += params[4];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 4 )
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
cell *pcvec = MF_GetAmxAddr( amx, params[3] );
cell *pcvec = MF_GetAmxAddr(amx, params[3]);
Vector vec( amx_ctof( pcvec[0] ), amx_ctof( pcvec[1] ), amx_ctof( pcvec[2] ) );
Vector vec(amx_ctof(pcvec[0]), amx_ctof(pcvec[1]), amx_ctof(pcvec[2]));
*( Vector* )( ( char* )INDEXENT2( index )->pvPrivateData + offset ) = vec;
*(Vector *)((char *)INDEXENT2(index)->pvPrivateData + offset) = vec;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_ehandle( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL get_pdata_ehandle(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
#if defined( __linux__ )
#if defined(__linux__)
offset += params[3];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 3 )
if (params[0] / sizeof(cell) == 3)
offset += params[3];
else
offset += params[4];
#endif
edict_t *pEdict = *( edict_t** )( ( char* )( INDEXENT2( index )->pvPrivateData ) + offset );
edict_t *pEdict = *(edict_t **)((char * )(INDEXENT2(index)->pvPrivateData) + offset);
if( pEdict == NULL )
if (pEdict == NULL)
{
return -1;
}
edict_t *pWorld = INDEXENT( 0 );
edict_t *pWorld = INDEXENT(0);
int ent = pEdict - pWorld;
if( ent < 0 || ent > gpGlobals->maxEntities )
if (ent < 0 || ent > gpGlobals->maxEntities)
{
return -2;
}
if( pEdict->free || pEdict->pvPrivateData == NULL )
if (pEdict->free || pEdict->pvPrivateData == NULL)
{
return -1;
}
int serialnumber = *( int* )( ( char* )INDEXENT2( index )->pvPrivateData + offset + 4 );
int serialnumber = *(int *)((char *)INDEXENT2(index)->pvPrivateData + offset + 4);
if( pEdict->serialnumber != serialnumber )
if (pEdict->serialnumber != serialnumber)
{
return 0;
}
@ -507,34 +507,34 @@ static cell AMX_NATIVE_CALL get_pdata_ehandle( AMX *amx, cell *params )
return ent;
}
static cell AMX_NATIVE_CALL set_pdata_ehandle( AMX *amx, cell *params )
static cell AMX_NATIVE_CALL set_pdata_ehandle(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY( index );
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET( offset );
CHECK_OFFSET(offset);
int entity = params[3];
CHECK_ENTITY( entity );
CHECK_ENTITY(entity);
#if defined( __linux__ )
#if defined(__linux__)
offset += params[4];
#elif defined( __APPLE__ )
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if( params[0] / sizeof( cell ) == 4 )
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
edict_t *pEntity = INDEXENT2( entity );
edict_t *pEntity = INDEXENT2(entity);
*( edict_t** )( ( char* )( INDEXENT2( index )->pvPrivateData ) + offset ) = pEntity;
*(edict_t **)((char* )(INDEXENT2(index)->pvPrivateData) + offset) = pEntity;
if( pEntity )
if (pEntity)
{
*( int* )( ( char* )INDEXENT2( index )->pvPrivateData + offset + 4 ) = pEntity->serialnumber;
*(int *)((char *)INDEXENT2(index)->pvPrivateData + offset + 4) = pEntity->serialnumber;
}
return 1;

View File

@ -112,7 +112,7 @@ native global_get(_value, any:...);
* @param _macdiff Mac OS X difference.
* @return An integer value is returned.
*/
native get_pdata_int( _index, _Offset, _linuxdiff = 5, _macdiff = 5 );
native get_pdata_int(_index, _Offset, _linuxdiff = 5, _macdiff = 5);
/**
* Sets an integer to an entity's private data.
@ -129,7 +129,7 @@ native get_pdata_int( _index, _Offset, _linuxdiff = 5, _macdiff = 5 );
* @param _macdiff Mac OS X difference.
* @return 1 on success.
*/
native set_pdata_int( _index, _Offset, _Value, _linuxdiff = 5, _macdiff = 5 );
native set_pdata_int(_index, _Offset, _Value, _linuxdiff = 5, _macdiff = 5);
/**
* Returns a float from an entity's private data.
@ -145,7 +145,7 @@ native set_pdata_int( _index, _Offset, _Value, _linuxdiff = 5, _macdiff = 5 );
* @param _macdiff Mac OS X difference.
* @return An float value is returned.
*/
native Float:get_pdata_float( _index, _Offset, _linuxdiff = 5, _macdiff = 5 );
native Float:get_pdata_float(_index, _Offset, _linuxdiff = 5, _macdiff = 5);
/**
* Sets a float to an entity's private data.
@ -162,7 +162,7 @@ native Float:get_pdata_float( _index, _Offset, _linuxdiff = 5, _macdiff = 5 );
* @param _macdiff Mac OS X difference.
* @return 1 on success.
*/
native set_pdata_float( _index, _Offset, Float:_Value, _linuxdiff = 5, _macdiff = 5 );
native set_pdata_float(_index, _Offset, Float:_Value, _linuxdiff = 5, _macdiff = 5);
/**
* Tries to retrieve an edict pointer from an entity's private data.
@ -183,7 +183,7 @@ native set_pdata_float( _index, _Offset, Float:_Value, _linuxdiff = 5, _macdiff
* -1 if an empty entity was found.
* Otherwise, an entity index is returned.
*/
native get_pdata_ent( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
native get_pdata_ent(_index, _offset, _linuxdiff = 20, _macdiff = 20);
/**
* Sets an edict pointer to an entity's private data.
@ -203,7 +203,7 @@ native get_pdata_ent( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
* @param _macdiff Mac OS X difference.
* @return 1 on success.
*/
native set_pdata_ent( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20 );
native set_pdata_ent(_index, _offset, _value, _linuxdiff = 20, _macdiff = 20);
/**
* Returns a boolean from an entity's private data.
@ -222,7 +222,7 @@ native set_pdata_ent( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20 );
* @param _macdiff Mac OS X difference.
* @return An boolean value is returned.
*/
native bool:get_pdata_bool( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
native bool:get_pdata_bool(_index, _offset, _linuxdiff = 20, _macdiff = 20);
/**
* Sets a boolean to an entity's private data.
@ -242,7 +242,7 @@ native bool:get_pdata_bool( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
* @param _macdiff Mac OS X difference.
* @return 1 on success.
*/
native set_pdata_bool( _index, _offset, bool:_value, _linuxdiff = 20, _macdiff = 20 );
native set_pdata_bool(_index, _offset, bool:_value, _linuxdiff = 20, _macdiff = 20);
/**
* Returns a byte value from an entity's private data.
@ -261,7 +261,7 @@ native set_pdata_bool( _index, _offset, bool:_value, _linuxdiff = 20, _macdiff =
* @param _macdiff Mac OS X difference.
* @return A byte value is returned.
*/
native get_pdata_byte( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
native get_pdata_byte(_index, _offset, _linuxdiff = 20, _macdiff = 20);
/**
* Sets a byte value to an entity's private data.
@ -281,7 +281,7 @@ native get_pdata_byte( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
* @param _macdiff Mac OS X difference.
* @return 1 on success.
*/
native set_pdata_byte( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20 );
native set_pdata_byte(_index, _offset, _value, _linuxdiff = 20, _macdiff = 20);
/**
* Returns a short value from an entity's private data.
@ -300,7 +300,7 @@ native set_pdata_byte( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20 )
* @param _macdiff Mac OS X difference.
* @return A short value is returned.
*/
native get_pdata_short( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
native get_pdata_short(_index, _offset, _linuxdiff = 20, _macdiff = 20);
/**
* Sets a short value to an entity's private data.
@ -320,7 +320,7 @@ native get_pdata_short( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
* @param _macdiff Mac OS X difference.
* @return 1 on success.
*/
native set_pdata_short( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20 );
native set_pdata_short(_index, _offset, _value, _linuxdiff = 20, _macdiff = 20);
/**
* Returns a vector from an entity's private data.
@ -340,7 +340,7 @@ native set_pdata_short( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20
* @param _macdiff Mac OS X difference.
* @return 1 on success.
*/
native get_pdata_vector( _index, _offset, Float:_output[3], _linuxdiff = 20, _macdiff = 20 );
native get_pdata_vector(_index, _offset, Float:_output[3], _linuxdiff = 20, _macdiff = 20);
/**
* Sets a vector to an entity's private data.
@ -360,7 +360,7 @@ native get_pdata_vector( _index, _offset, Float:_output[3], _linuxdiff = 20, _ma
* @param _macdiff Mac OS X difference.
* @return 1 on success.
*/
native set_pdata_vector( _index, _offset, Float:_origin[3], _linuxdiff = 20, _macdiff = 20 );
native set_pdata_vector(_index, _offset, Float:_origin[3], _linuxdiff = 20, _macdiff = 20);
/**
* Tries to retrieve an edict (entity encapsulation) pointer from an entity's private data.
@ -382,7 +382,7 @@ native set_pdata_vector( _index, _offset, Float:_origin[3], _linuxdiff = 20, _ma
* 0 if serialnumber is not matching.
* Otherwise, an entity index is returned.
*/
native get_pdata_ehandle( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
native get_pdata_ehandle(_index, _offset, _linuxdiff = 20, _macdiff = 20);
/**
* Sets an edict (entity encapsulation) pointer to an entity's private data.
@ -402,7 +402,7 @@ native get_pdata_ehandle( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
* @param _macdiff Mac OS X difference.
* @return 1 on success.
*/
native set_pdata_ehandle( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20 );
native set_pdata_ehandle(_index, _offset, _value, _linuxdiff = 20, _macdiff = 20);
/* Registers a forward.
* Returns an id you can pass to unregister_forward