Example #1
0
/**
 * Shutdown routine for the server.
 */
void Sv_Shutdown(void)
{
#ifdef _DEBUG
if(totalFrameCount > 0)
{
    uint                i;

    // Byte probabilities.
    for(i = 0; i < 256; ++i)
    {
        LOGDEV_NET_NOTE("Byte %02x: %f") << i << (byteCounts[i] / (float) totalFrameCount);
    }
}
#endif

    Sv_ShutdownPools();
}
Example #2
0
void Cl_Frame2Received(int packetType)
{
    // The first thing in the frame is the gameTime.
    frameGameTime = Reader_ReadFloat(msgReader);

    // All frames that arrive before the first frame are ignored.
    // They are most likely from the wrong map.
    if (packetType == PSV_FIRST_FRAME2)
    {
        gotFirstFrame = true;
    }
    else if (!gotFirstFrame)
    {
        // Just ignore. If this was a legitimate frame, the server will
        // send it again when it notices no ack is coming.
        return;
    }

    // Read and process the message.
    while (!Reader_AtEnd(msgReader))
    {
        byte const deltaType = Reader_ReadByte(msgReader);

        switch (deltaType)
        {
        case DT_CREATE_MOBJ:
            // The mobj will be created/shown.
            ClMobj_ReadDelta();
            break;

        case DT_MOBJ:
            // The mobj will be hidden if it's not yet Created.
            ClMobj_ReadDelta();
            break;

        case DT_NULL_MOBJ:
            // The mobj will be removed.
            ClMobj_ReadNullDelta();
            break;

        case DT_PLAYER:
            ClPlayer_ReadDelta();
            break;

        case DT_SECTOR:
            Cl_ReadSectorDelta(deltaType);
            break;

        //case DT_SIDE_R6: // Old format.
        case DT_SIDE:
            Cl_ReadSideDelta(deltaType);
            break;

        case DT_POLY:
            Cl_ReadPolyDelta();
            break;

        case DT_SOUND:
        case DT_MOBJ_SOUND:
        case DT_SECTOR_SOUND:
        case DT_SIDE_SOUND:
        case DT_POLY_SOUND:
            Cl_ReadSoundDelta((deltatype_t) deltaType);
            break;

        default:
            LOG_NET_ERROR("Received unknown delta type %i (message size: %i bytes)")
                    << deltaType << netBuffer.length;
            return;
        }
    }

    if (!gotFrame)
    {
        LOGDEV_NET_NOTE("First frame received");
    }

    // We have now received a frame.
    gotFrame = true;
}