当前位置: 首页>>代码示例>>C++>>正文


C++ EventData::getQualiPeriod方法代码示例

本文整理汇总了C++中EventData::getQualiPeriod方法的典型用法代码示例。如果您正苦于以下问题:C++ EventData::getQualiPeriod方法的具体用法?C++ EventData::getQualiPeriod怎么用?C++ EventData::getQualiPeriod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventData的用法示例。


在下文中一共展示了EventData::getQualiPeriod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addInLap

void DriverData::addInLap(const EventData &ed)
{
    if (lastLap.lapNum <= 0)
        return;

    lapData.append(lastLap);

    if (outLap == true)
        lapData.last().lapTime = LapTime("INST. LAP");
    else
        lapData.last().lapTime = LapTime("IN LAP");

    lapData.last().qualiLapExtraData.sessionTime = ed.getRemainingTime();
    lapData.last().practiceLapExtraData.sessionTime = ed.getRemainingTime();

    if (ed.getEventType() == LTPackets::QUALI_EVENT)
    {
        int qPeriod = ed.getQualiPeriod() > 0 ? ed.getQualiPeriod() : 1;
        lastLap.qualiLapExtraData.qualiPeriod = qPeriod;
        lapData.last().qualiLapExtraData.qualiPeriod = qPeriod;
    }
    updateSectorRecords();
}
开发者ID:primijos,项目名称:f1lt,代码行数:23,代码来源:driverdata.cpp

示例2: correctPosition

//during Q1 when the drivers time is worse than 107% lt server doesn't update his position, we have to do this manually
void DriverData::correctPosition(const EventData &ed)
{
    if (ed.getQualiPeriod() == 1 && ed.getSessionRecords().getFastestLap().getTime().isValid() &&
            ((ed.getSessionRecords().getFastestLap().getTime().calc107p() < qualiTimes[0]) ||
             !qualiTimes[0].isValid()))
    {
        int position = ed.correctPosition(qualiTimes[0]);

        if (position >= 1)
        {
            pos = position;
            lastLap.pos = position;
            sessionRecords.bestQLaps[0].pos = position;

            int idx = lapData.indexOf(sessionRecords.getBestQualiLap(1));
            if (idx >= 0)
                lapData[idx].pos = position;
        }
//        colorData.positionColor() = LTPackets::RED;
    }
}
开发者ID:primijos,项目名称:f1lt,代码行数:22,代码来源:driverdata.cpp

示例3: addFPQLap

void DriverData::addFPQLap(const EventData &ed)
{
    //during practice and quali we only save timed laps
    if ((lastLap.lapTime.toString() != "") && (lapData.empty() ||
            (/*(lastLap.numLap > lapData.last().numLap) &&*/ lastLap.getSectorTime(1).toString() != "" && lastLap.getSectorTime(2).toString() != "" && lastLap.getSectorTime(3).toString() != "")))
    {
        bool correction = false;
        //sometimes servers messes up with lap numbers, we catch this if the numlap is <= than the last one
        if (!lapData.isEmpty() && lastLap.lapNum+1 <= lapData.last().lapNum)
        {
            correction = true;
            bool approx = lapData.last().qualiLapExtraData.approxLap || lapData.last().practiceLapExtraData.approxLap;
            int numlap = lapData.last().lapNum-1;
            lapData.last() = LapData(lastLap);
            lapData.last().qualiLapExtraData.approxLap = approx;
            lapData.last().practiceLapExtraData.approxLap = approx;

            if (lapData.size() > 1)
                lapData.last().lapNum = numlap;


            if (sessionRecords.bestLap.lapNum == numlap)
                sessionRecords.bestLap.lapNum = lapData.last().lapNum;
        }
        else
        {

            //if decryption fails, replace the garbage we obtained with the best lap time
            if (lastLap.lapTime.toString() != "" && !lastLap.lapTime.isValid())
                lastLap.lapTime = sessionRecords.bestLap.lapTime;

            lastLap.qualiLapExtraData.sessionTime = ed.getRemainingTime();
            lastLap.practiceLapExtraData.sessionTime = ed.getRemainingTime();
            lapData.append(lastLap);
            lapData.last().lapNum--;

            if (ed.getEventType() == LTPackets::QUALI_EVENT)
            {
                int qPeriod = ed.getQualiPeriod() > 0 ? ed.getQualiPeriod() : 1;
                lastLap.qualiLapExtraData.qualiPeriod = qPeriod;
                lapData.last().qualiLapExtraData.qualiPeriod = qPeriod;

            }

            updateSectorRecords();
        }

        if (!correction)
        {
            if (ed.getEventType() == LTPackets::PRACTICE_EVENT)
            {
                if (lastLap < sessionRecords.bestLap)
                    sessionRecords.bestLap = lapData.last();

                else if (lastLap.lapTime == sessionRecords.bestLap.lapTime)
                {
                    lapData.last().lapTime = LapData::sumSectors(lapData.last().getSectorTime(1).toString(), lapData.last().getSectorTime(2).toString(), lapData.last().getSectorTime(3).toString());
                    lapData.last().practiceLapExtraData.approxLap = true;
                }
                else
                    lapData.last().practiceLapExtraData.approxLap = false;

            }
            else if (ed.getEventType() == LTPackets::QUALI_EVENT)
            {
                if (lastLap < sessionRecords.bestLap)
                    sessionRecords.bestLap = lapData.last();

                if (lastLap < sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1] ||
                        !sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1].getTime().isValid())
                {
                    sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1] = lapData.last();

                    if (sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1] < sessionRecords.bestLap)
                        sessionRecords.bestLap = sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1];
                }
                //if the current lap time is the same as the best lap, probably the driver hasn't improved so we have to calculate the real lap time from the sectors time
                else if (lastLap.lapTime == sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1].lapTime)
                {
                    lapData.last().lapTime = LapData::sumSectors(lapData.last().getSectorTime(1).toString(), lapData.last().getSectorTime(2).toString(), lapData.last().getSectorTime(3).toString());
                    lapData.last().qualiLapExtraData.approxLap = true;
                }
                else
                    lapData.last().qualiLapExtraData.approxLap = false;

                correctPosition(ed);
            }

        }
        lapData.last().gap = QString::number((lapData.last().lapTime - ed.getSessionRecords().getFastestLap().getTime()).toDouble());

        posHistory.append(lastLap.pos);
        outLap = false;
    }

    //saving in and out laps
    else if (lastLap.lapNum > 1)
    {
        if (lapData.isEmpty() || (!lapData.isEmpty() && lapData.last().lapNum < lastLap.lapNum-1))
        {
//.........这里部分代码省略.........
开发者ID:primijos,项目名称:f1lt,代码行数:101,代码来源:driverdata.cpp


注:本文中的EventData::getQualiPeriod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。