Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rules/iota/iota
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LOGFILE=iota.log

CONTEST_MODE

GENERIC_MULT = BAND
GENERIC_MULT = BAND+MODE

# scoring and mults handled by iota.py
# Island stations shall specify their reference via PLUGIN_CONFIG=CC-NNN
Expand Down
6 changes: 0 additions & 6 deletions rules/iota/iota.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,10 @@ def check_exchange(qso):

mult = ''

# As per-mode (CW/SSB) multipliers are not supported yet
# it is worked around by appending c/s to the multiplier value.
xchg = f'{serial:03}'
if ref:
xchg += ' ' + ref
mult = ref
if qso.mode == tlf.CWMODE:
mult += 'c'
else:
mult += 's'
else:
xchg += ' ------'

Expand Down
13 changes: 10 additions & 3 deletions rules/pacc_dx
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
#########################################
# PACC contest for stations outside PA0 #
# PACC contest for stations outside PA #
# PA0R, 3.10.2003 #
# #
# Updated by: Zoltan Csahok HA5CQZ #
#########################################
# https://veron.nl/vereniging/commissies-en-werkgroepen/traffic-bureau/hf-contesten/pacc-home/
#
#
CONTEST=pacc_dx
LOGFILE=paccdx.log
CONTEST_MODE
CABRILLO=UNIVERSAL
CABRILLO-CONTEST=PACC
#################################
MULT_LIST=paccmults
COUNTRYLIST=PA
USE_COUNTRYLIST_ONLY
COUNTRY_LIST_POINTS=1
SECTION_MULT

SECTION_MULT=BAND+MODE
MULT_LIST=paccmults

RECALL_MULTS
SERIAL_EXCHANGE
SHORT_SERIAL
Expand Down
9 changes: 3 additions & 6 deletions rules/template
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,20 @@ S&P_TU_MSG=TU 5NN #
#-------------------------------
# Multiplier type:
#
#WYSIWYG_MULTIBAND
#WYSIWYG_MULTI=BAND
# (makes its own multiplier list
# on the go...)
#
#WYSIWYG_ONCE
#WYSIWYG_MULTI=ALL
# (same, but mults do not count
# per band..)
#
#
#MULT_LIST=arrlsections
#MULT_LIST=us_canada_states

#SERIAL_SECTIONS
#DX_&_SECTIONS
#SECTION_MULT
#SECTION_MULT=BAND

#POWERMULT_5
#POWERMULT_2
Expand All @@ -116,9 +115,7 @@ S&P_TU_MSG=TU 5NN #
#ONE_POINT
#TWO_POINTS
#THREE_POINTS
#2EU3DX_POINTS
#
#USE_COUNTRYLIST_ONLY
#COUNTRYLIST=SP,HA
#COUNTRY_LIST_POINTS=10
#MY_COUNTRY_POINTS=2
Expand Down
109 changes: 49 additions & 60 deletions src/addmult.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ static int remember_generic_mult(struct qso_t *qso, bool check_only) {
gchar *mult = g_strdup(word);
g_strchomp(mult); // remove trailing whitespace for mult check

int mult_index = remember_multi(mult, qso->bandindex, generic_mult, check_only);
int mult_index = remember_multi(mult, qso->bandindex, qso->mode, generic_mult,
check_only);

if (mult_index >= 0) {
if (first_mult_index < 0) {
Expand Down Expand Up @@ -111,29 +112,30 @@ static int addmult_internal(struct qso_t *qso, bool check_only) {

idx = get_exact_mult_index(qso->mult1_value);
if (idx >= 0) {
remember_multi(get_mult(idx), qso->bandindex, MULT_ALL, check_only);
remember_multi(get_mult(idx), qso->bandindex, qso->mode, MULT_ALL, check_only);
// NOTE: return value not used, new mult is not marked in log
}
}

// ---------------------------serial + section ---------------------------
else if (serial_section_mult || sectn_mult) {
else if (serial_section_mult) {

/* is it a mult? */
idx = get_exact_mult_index(qso->mult1_value);
if (idx >= 0) {
mult_index =
remember_multi(get_mult(idx), qso->bandindex, MULT_BAND, check_only);
remember_multi(get_mult(idx), qso->bandindex, qso->mode, MULT_BAND, check_only);
}
}

// --------------------------- section_mult_once--------------------------
else if (sectn_mult_once) {
// --------------------------- section_mult --------------------------
else if (sectn_mult != MULT_NONE) {
/* is it a mult? */
idx = get_exact_mult_index(qso->mult1_value);
if (idx >= 0) {
mult_index =
remember_multi(get_mult(idx), qso->bandindex, MULT_ALL, check_only);
remember_multi(get_mult(idx), qso->bandindex, qso->mode, sectn_mult,
check_only);
}
}

Expand All @@ -143,31 +145,26 @@ static int addmult_internal(struct qso_t *qso, bool check_only) {
idx = get_exact_mult_index(qso->mult1_value);
if (idx >= 0) {
mult_index =
remember_multi(get_mult(idx), qso->bandindex, MULT_BAND, check_only);
remember_multi(get_mult(idx), qso->bandindex, qso->mode, MULT_BAND, check_only);
}
}

// --------------------wysiwyg----------------
else if (wysiwyg_once) {
mult_index = remember_multi(stripped_comment, qso->bandindex, MULT_ALL,
check_only);
}

else if (wysiwyg_multi) {
mult_index = remember_multi(stripped_comment, qso->bandindex, MULT_BAND,
check_only);
else if (wysiwyg_mult != MULT_NONE) {
mult_index = remember_multi(stripped_comment, qso->bandindex, qso->mode,
wysiwyg_mult, check_only);
}

/* -------------- unique call multi -------------- */
else if (unique_call_multi != MULT_NONE) {
mult_index = remember_multi(qso->call, qso->bandindex, unique_call_multi,
check_only);
mult_index = remember_multi(qso->call, qso->bandindex, qso->mode,
unique_call_multi, check_only);
}

/* ------------ grid mult (per band) ------------- */
else if (serial_grid4_mult) {
mult_index = remember_multi(qso->mult1_value, qso->bandindex, MULT_BAND,
check_only);
mult_index = remember_multi(qso->mult1_value, qso->bandindex, qso->mode,
MULT_BAND, check_only);
}

// ----------- generic: use mult1 -----------
Expand Down Expand Up @@ -196,6 +193,7 @@ void addmult_lan(void) {
char stripped_comment[21];
char multi_call[20];
bool check_only = false;//FIXME param
int mode = CWMODE;//FIXME use actual mode

new_mult = -1;

Expand All @@ -213,35 +211,29 @@ void addmult_lan(void) {
}

if (idx >= 0) {
remember_multi(get_mult(idx), bandinx, MULT_ALL, check_only);
remember_multi(get_mult(idx), bandinx, mode, MULT_ALL, check_only);
}
}

// --------------------wysiwyg----------------
if (wysiwyg_once) {
if (wysiwyg_mult != MULT_NONE) {
g_strlcpy(stripped_comment, lan_logline + 54, 15);
g_strchomp(stripped_comment);

new_mult = remember_multi(stripped_comment, bandinx, MULT_ALL, check_only);
}

if (wysiwyg_multi) {
g_strlcpy(stripped_comment, lan_logline + 54, 15);
g_strchomp(stripped_comment);

new_mult = remember_multi(stripped_comment, bandinx, MULT_BAND, check_only);
new_mult = remember_multi(stripped_comment, bandinx, mode, wysiwyg_mult,
check_only);
}

/* -------------- unique call multi -------------- */
g_strlcpy(multi_call, lan_logline + 68, 10);
g_strchomp(multi_call);

if (unique_call_multi == MULT_ALL) {
new_mult = remember_multi(multi_call, bandinx, MULT_ALL, check_only);
new_mult = remember_multi(multi_call, bandinx, mode, MULT_ALL, check_only);
}

if (unique_call_multi == MULT_BAND) {
new_mult = remember_multi(multi_call, bandinx, MULT_BAND, check_only);
new_mult = remember_multi(multi_call, bandinx, mode, MULT_BAND, check_only);
}

}
Expand Down Expand Up @@ -444,62 +436,59 @@ int init_and_load_multipliers(void) {

/** initialize mults scoring
*
* empties multis[] array, set the number of multis and multscore per band to 0.
* empties multis[] array,
* sets the number of multis and multscore per band to 0.
*/
void init_mults() {
int n;

for (n = 0; n < MAX_MULTS; n++) {
multis[n].name[0] = '\0';
multis[n].band = 0;
}

memset(multis, 0, sizeof(multis));
memset(multscore, 0, sizeof(multscore));
nr_multis = 0;

for (n = 0; n < NBANDS; n++)
multscore[n] = 0;
}

static pthread_mutex_t mult_mutex = PTHREAD_MUTEX_INITIALIZER;

/** register worked multiplier and check if its new
/** register worked multiplier and check if it's a new one
*
* Check if multiplier is already registered. If not make a new entry in
* multis[] array and increment the total mults count 'nr_multis'.
* Mark the mult as worked on the actual band. If it is a new band
* Mark the mult as worked on the actual band. If it is a new band or mode
* increase the bandspecific 'multscore[band]'.
*
* \param multiplier - the multiplier as a string
* \param band - the bandindex we are on
* \param mode - the mode used in this QSO
* \param mult_mode - MULT_BAND -> check also if new band
* \param check_only - do not record mult, only check it
* \return - index into mults[] array if new mult or on new band
* \return - index into mults[] array if new mult or on new band/mode
* (-1 if multiplier is an empty string or not new)
*/
int remember_multi(char *multiplier, int band, int mult_mode, bool check_only) {
/* search multbuffer in mults array */
int remember_multi(char *multiplier, int band, int mode, int mult_mode,
bool check_only) {

bool found = false;
int index = -1;
if (multiplier == NULL || *multiplier == '\0' || mult_mode == MULT_NONE)
return -1; /* ignore if empty string or disabled */

int bandmask = inxes[band];

int effective_mode = CWMODE;
if (mult_mode == MULT_BAND_MODE) {
effective_mode = mode; // use actual mode for band+mode
}

pthread_mutex_lock(&mult_mutex);

for (int i = 0; i < nr_multis; i++) {
/* already in list? */
if (strcmp(multis[i].name, multiplier) == 0) {
found = 1;
found = true;

/* new band? check if mult is per band */
if ((multis[i].band & inxes[band]) == 0) {

if (!check_only) {
// update band even if not strictly needed
multis[i].band |= inxes[band];
}
/* new band or mode? */
if ((multis[i].band[effective_mode] & bandmask) == 0) {

if (mult_mode == MULT_BAND) {
index = i; // new band
if (mult_mode == MULT_BAND || mult_mode == MULT_BAND_MODE) {
index = i; // yes, a new one
}
}

Expand All @@ -508,7 +497,7 @@ int remember_multi(char *multiplier, int band, int mult_mode, bool check_only) {
}

// found && index < 0: not new mult
// found && index >= 0: existing mult on a new band
// found && index >= 0: existing mult on a new band or mode
// !found: new mult

if (!found) {
Expand All @@ -520,7 +509,7 @@ int remember_multi(char *multiplier, int band, int mult_mode, bool check_only) {
strcpy(multis[index].name, multiplier);
nr_multis++;
}
multis[index].band |= inxes[band];
multis[index].band[effective_mode] |= bandmask;
multscore[band]++;
}

Expand Down
3 changes: 2 additions & 1 deletion src/addmult.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ int get_mult_count(void);
unsigned int get_matching_length(char *str, unsigned int n);
int get_exact_mult_index(char *str);
int init_and_load_multipliers(void);
int remember_multi(char *multiplier, int band, int mult_mode, bool check_only);
int remember_multi(char *multiplier, int band, int mode, int mult_mode,
bool check_only);
void init_mults();

#endif /* ADDMULT_H */
6 changes: 3 additions & 3 deletions src/changepars.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,8 @@ void multiplierinfo(void) {
}
}

if (serial_section_mult || sectn_mult_once
|| (sectn_mult && !CONTEST_IS(ARRL_SS))) {
if (serial_section_mult || sectn_mult == MULT_ALL
|| (sectn_mult == MULT_BAND && !CONTEST_IS(ARRL_SS))) {
char *tmp;
int worked_at;

Expand All @@ -817,7 +817,7 @@ void multiplierinfo(void) {
/* lookup if already worked */
for (k = 0; k < nr_multis; k++) {
if (strstr(multis[k].name, get_mult(cnt)) != NULL) {
worked_at = multis[k].band;
worked_at = multis[k].band[trxmode]; // FIXME: check this
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/getexchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ int getexchange(void) {
mvaddstr(13, 54, "section?");
mvaddstr(12, 54, current_qso.comment);
x = 0;
} else if ((serial_section_mult || sectn_mult)
} else if ((serial_section_mult || sectn_mult != MULT_NONE)
&& ((x != TAB) && (strlen(current_qso.section) < 1))) {
if (!serial_or_section
|| (serial_or_section && country_found(current_qso.call))) {
Expand Down Expand Up @@ -794,7 +794,7 @@ void checkexchange(struct qso_t *qso, bool interactive) {
}

// ----------------------section only----------------------------
if (sectn_mult || sectn_mult_once || dx_arrlsections) {
if (sectn_mult != MULT_NONE || dx_arrlsections) {

checkexchange_sectn_mult(qso, interactive);
return;
Expand Down
6 changes: 2 additions & 4 deletions src/globalvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ extern int qsos_per_band[NBANDS];
extern int zones[MAX_ZONES];
extern bool serial_section_mult;
extern bool serial_grid4_mult;
extern bool sectn_mult;
extern bool sectn_mult_once;
extern int sectn_mult;
extern bool dx_arrlsections;
extern bool wysiwyg_multi;
extern bool wysiwyg_once;
extern int wysiwyg_mult;
extern char wpx_prefix[];
extern int zonescore[NBANDS];
extern int countryscore[NBANDS];
Expand Down
Loading