示例#1
0
bool ARRL10::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);
    fillDefaultRST(qso);

    finalExch[1].clear();
    qso->rcv_exch[0].clear();
    qso->rcv_exch[1].clear();
    bool ok = false;

    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    qso->pts = 0;
    determineMultType(qso);

    // mobile ITU regions (RST) R1, (RST) R2, (RST) R3
    // not using validator in contest.cpp since here R1/R2/R3 are
    // multipliers
    if (qso->isMM) {
        for (int i = exchElement.size() - 1; i >= 0; i--) {
            int r = 0;
            if (exchElement[i] == "R1") r = 1;
            if (exchElement[i] == "R2") r = 2;
            if (exchElement[i] == "R3") r = 3;
            if (r) {
                // make this count as "domestic mult" regardless of actual country of callsign
                qso->mult[1]    = -1;
                qso->isamult[0] = true;
                break;
            }
        }
    }
    if (qso->isamult[0]) {
        // Domestic call: (RST) state
        ok = valExch_rst_state(0, qso->mult[0]);
    } else if (qso->isamult[1]) {
        // DX: (RST) #
        // two things entered; assume first is rst
        int inr = 0;
        if (exchElement.size() == 2) {
            finalExch[0] = exchElement[0];
            inr          = 1;
        }

        // serial number; must be convertable to int
        bool iok = false;
        exchElement[inr].toInt(&iok, 10);
        if (iok) {
            ok           = true;
            finalExch[1] = exchElement[inr];
        }
    }
    copyFinalExch(ok, qso);
    return(ok);
}
示例#2
0
bool ARRLDX::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);

    fillDefaultRST(qso);
    finalExch[1].clear();
    qso->rcv_exch[0].clear();
    qso->rcv_exch[1].clear();
    bool ok = false;

    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    // get the exchange
    determineMultType(qso);

    qso->pts = 0;

    // for US/VE stations
    if (usVe) {
        // mobile stations: /MM /AM qso credit but not a mult
        if (qso->isMM) {
            qso->mult[0]    = -1;
            qso->isamult[0] = true;
        }
        if (qso->isamult[0]) {
            ok = valExch_rst_name(qso);
            if (ok) {
                qso->pts = 3;
            }
        }
    } else {
        // DX stations
        if (qso->isamult[0]) {
            ok = valExch_rst_state(0, qso->mult[0]);
            if (ok) {
                qso->pts = 3;
            }
        }
    }
    if (qso->dupe) qso->pts = 0;
    copyFinalExch(ok, qso);
    return(ok);
}
示例#3
0
bool IARU::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);
    bool ok = false;
    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    determineMultType(qso);

    // auto-fill rst
    if (qso->mode == RIG_MODE_CW || qso->mode == RIG_MODE_CWR ||
        qso->mode == RIG_MODE_RTTY || qso->mode == RIG_MODE_RTTYR) {
        finalExch[0] = "599";
    } else {
        finalExch[0] = "59";
    }

    // is it a HQ or official?
    qso->isamult[1] = valExch_rst_state(1, qso->mult[1]);
    if (qso->isamult[1]) {
        // HQ's don't count for zone mult
        qso->isamult[0] = false;
        qso->mult[0]    = -1;
        qso->zone       = 0;
    } else {
        // not a HQ : (RST) + zone
        if (exchElement.size() == 2) {
            finalExch[0] = exchElement[0]; // rst
            finalExch[1] = exchElement[1]; // zone
        } else {
            finalExch[1] = exchElement[0]; // zone
        }

        // parse zone. ok is true if conversion to integer succeeds
        qso->zone = finalExch[1].toInt(&ok, 10);
        if (ok && qso->zone > 0 && qso->zone <= zoneMax()) {
            qso->isamult[0] = true;
            qso->mult[0]    = qso->zone - 1; // important: update zone with what was logged!
        } else {
            qso->isamult[0] = false;
            qso->zone       = 0;
            qso->mult[0]    = -1;
            qso->continent  = ALL;
        }
    }
    qso->mult_name = finalExch[1];
    ok             = qso->isamult[0] || qso->isamult[1];

    for (int i = 0; i < nExch; i++) {
        qso->rcv_exch[i] = finalExch[i];
    }

    // dupes get zero pts
    if (qso->dupe) {
        qso->pts = 0;
        return(ok);
    }

    // unknown mults: assign 1 point; it may be a HQ station not on list
    if (qso->isamult[0] == false && qso->isamult[1] == false) {
        qso->pts = 1;
        return(ok);
    }
    if (qso->zone == _myZone || qso->isamult[1]) {
        // same zone, HQ, IARU official : 1 pt
        qso->pts = 1;
    } else if (qso->continent == myContinent) {
        qso->pts = 3;
    } else {
        qso->pts = 5;
    }
    return(ok);
}