20.12.2013, 03:33
Каким образом можно очистить весь enim, который содержит также двухмерные массивы, не называя их?
enum ePlayers {
a,
c,
Float:d[3]
}
new playerData[MAX_PLAYERS][ePlayers];
new defaultPlayerInfo[ePlayers] = {
0,
0,
{0.0, 0.0, 0.0},
};
//очистка
playerData[5] = defaultPlayerInfo;
pawn Код:
|
stock memset ( aArray[], iValue, iSize = sizeof ( aArray ) )
{
new iAddress;
#emit LOAD.S.pri 12
#emit STOR.S.pri iAddress
iSize *= 4;
while ( iSize > 0 )
{
if (iSize >= 4096)
{
#emit LOAD.S.alt iAddress
#emit LOAD.S.pri iValue
#emit FILL 4096
iSize -= 4096;
iAddress += 4096;
}
else if ( iSize >= 1024 )
{
#emit LOAD.S.alt iAddress
#emit LOAD.S.pri iValue
#emit FILL 1024
iSize -= 1024;
iAddress += 1024;
}
else if ( iSize >= 256 )
{
#emit LOAD.S.alt iAddress
#emit LOAD.S.pri iValue
#emit FILL 256
iSize -= 256;
iAddress += 256;
}
else if ( iSize >= 64 )
{
#emit LOAD.S.alt iAddress
#emit LOAD.S.pri iValue
#emit FILL 64
iSize -= 64;
iAddress += 64;
}
else if ( iSize >= 16 )
{
#emit LOAD.S.alt iAddress
#emit LOAD.S.pri iValue
#emit FILL 16
iSize -= 16;
iAddress += 16;
}
else
{
#emit LOAD.S.alt iAddress
#emit LOAD.S.pri iValue
#emit FILL 4
iSize -= 4;
iAddress += 4;
}
}
#pragma unused aArray
}
enum _player {
var
}
new PLAYER [ MAX_PLAYERS ] [ _player ] ;
//
memset ( PLAYER [ playerid ], 0, _:_player ) ;