-
Notifications
You must be signed in to change notification settings - Fork 30
Unoccupied sync validity checks
Nexius edited this page Oct 14, 2024
·
14 revisions
#if !defined IsNaN
#define IsNaN(%0) ((%0) != (%0))
#endif
const UNOCCUPIED_SYNC = 209;
IPacket:UNOCCUPIED_SYNC(playerid, BitStream:bs)
{
new unoccupiedData[PR_UnoccupiedSync];
BS_IgnoreBits(bs, 8); // ignore packetid (byte)
BS_ReadUnoccupiedSync(bs, unoccupiedData);
if (IsNaN(unoccupiedData[PR_roll][0])
|| IsNaN(unoccupiedData[PR_roll][1])
|| IsNaN(unoccupiedData[PR_roll][2])
|| IsNaN(unoccupiedData[PR_direction][0])
|| IsNaN(unoccupiedData[PR_direction][1])
|| IsNaN(unoccupiedData[PR_direction][2])
|| IsNaN(unoccupiedData[PR_position][0])
|| IsNaN(unoccupiedData[PR_position][1])
|| IsNaN(unoccupiedData[PR_position][2])
|| IsNaN(unoccupiedData[PR_angularVelocity][0])
|| IsNaN(unoccupiedData[PR_angularVelocity][1])
|| IsNaN(unoccupiedData[PR_angularVelocity][2])
|| IsNaN(unoccupiedData[PR_velocity][0])
|| IsNaN(unoccupiedData[PR_velocity][1])
|| IsNaN(unoccupiedData[PR_velocity][2])
|| floatabs(unoccupiedData[PR_position][0]) >= 20000.0
|| floatabs(unoccupiedData[PR_position][1]) >= 20000.0
|| floatabs(unoccupiedData[PR_position][2]) >= 20000.0
|| floatabs(unoccupiedData[PR_angularVelocity][0]) >= 1.0
|| floatabs(unoccupiedData[PR_angularVelocity][1]) >= 1.0
|| floatabs(unoccupiedData[PR_angularVelocity][2]) >= 1.0
|| floatabs(unoccupiedData[PR_velocity][0]) >= 100.0
|| floatabs(unoccupiedData[PR_velocity][1]) >= 100.0
|| floatabs(unoccupiedData[PR_velocity][2]) >= 100.0
) {
return 0; // ignore bad packet
}
return 1;
}
- Refer to BrunoBM16's RPC and Packet lists