void CBasePlayer::SendAmmoUpdate(void) { for (int i=0; i < MAX_AMMO_SLOTS;i++) { if (m_rgAmmo[i] != m_rgAmmoLast[i]) { m_rgAmmoLast[i] = m_rgAmmo[i]; ASSERT( m_rgAmmo[i] >= 0 ); ASSERT( m_rgAmmo[i] < 255 ); // send "Ammo" update message MESSAGE_BEGIN( MSG_ONE, gmsgAmmoX, NULL, pev ); WRITE_BYTE( i ); WRITE_BYTE( max( min( m_rgAmmo[i], 254 ), 0 ) ); // clamp the value to one byte MESSAGE_END(); } } }