Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion rules/spdx_dx
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#########################################
# SPDX contest for stations outside SP #
# PA0R, 3.10.2003 #
# https://spdxcontest.pzk.org.pl #
#########################################
#
CONTEST=spdx_dx
LOGFILE=spdx.log
CONTEST_MODE
CABRILLO=UNIVERSAL
CABRILLO-CONTEST=SPDX
#################################
MULT_LIST=spdxmults
COUNTRYLIST=SP
USE_COUNTRYLIST_ONLY
COUNTRY_LIST_POINTS=3
SECTION_MULT
SERIAL_OR_SECTION
RECALL_MULTS
SERIAL_EXCHANGE
SHORT_SERIAL
Expand Down
1 change: 0 additions & 1 deletion rules/template
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ S&P_TU_MSG=TU 5NN #
#ONE_POINT
#TWO_POINTS
#THREE_POINTS
#2EU3DX_POINTS
#
#USE_COUNTRYLIST_ONLY
#COUNTRYLIST=SP,HA
Expand Down
2 changes: 0 additions & 2 deletions src/globalvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ extern char fkey_header[60];

extern SCREEN *mainscreen;

extern bool mult_side;
extern bool countrylist_only;
extern bool mixedmode;
extern bool qso_once;
extern bool leading_zeros_serial;
Expand Down
2 changes: 0 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,11 @@ int my_country_points = -1;
int my_cont_points = -1;
int dx_cont_points = -1;
char countrylist[255][6];
bool countrylist_only = false;
int countrylist_points = -1;
char continent_multiplier_list[7][3]; // SA, NA, EU, AF, AS and OC
int continentlist_points = -1;
bool continentlist_only = false;
int exclude_multilist_type = EXCLUDE_NONE;
bool mult_side = false;
/* end LZ3NY mods */

bool portable_x2 = false;
Expand Down
12 changes: 4 additions & 8 deletions src/parse_logcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

bool exist_in_country_list();

void Complain(char *msg);
void KeywordNotSupported(const char *keyword);
void ParameterNeeded(const char *keyword);
void ParameterUnexpected(const char *keyword);
Expand Down Expand Up @@ -809,9 +810,6 @@ static int cfg_countrylist(const cfg_arg_t arg) {
}
}

/* on which multiplier side of the rules we are */
getpx(my.call);
mult_side = exist_in_country_list();
setcontest(whichcontest);
free(buffer);

Expand Down Expand Up @@ -912,10 +910,8 @@ static int cfg_continentlist(const cfg_arg_t arg) {
}

static int cfg_country_list_only(const cfg_arg_t arg) {
countrylist_only = true;
if (mult_side) {
countrylist_only = false;
}
Complain("USE_COUNTRYLIST_ONLY is deprecated, see man page");

return PARSE_OK;
}

Expand Down Expand Up @@ -1457,7 +1453,7 @@ static config_t logcfg_configs[] = {
{"DX_&_SECTIONS", NO_PARAM, cfg_dx_n_sections},
{"COUNTRYLIST", NEED_PARAM, cfg_countrylist},
{"CONTINENTLIST", NEED_PARAM, cfg_continentlist},
{"USE_COUNTRYLIST_ONLY", NO_PARAM, cfg_country_list_only},
{"USE_COUNTRYLIST_ONLY", OPTIONAL_PARAM, cfg_country_list_only},
{"SIDETONE_VOLUME", NEED_PARAM, cfg_sc_volume},
{"MFJ1278_KEYER", NEED_PARAM, cfg_mfj1278_keyer},
{"CHANGE_RST", OPTIONAL_PARAM, cfg_change_rst},
Expand Down
59 changes: 21 additions & 38 deletions src/score.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* Tlf - contest logging program for amateur radio operators
* Copyright (C) 2001-2002-2003 Rein Couperus <pa0rct@amsat.org>
* 2013 Ervin Hegedus <airween@gmail.com>
* 2013-2015, 2020
* Thomas Beierlein <tb@forth-ev.de>
* 2013-2023 Thomas Beierlein <tb@forth-ev.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -98,7 +97,7 @@ bool exist_in_country_list() {
}


/* HA2OS - check if continent is in CONTINENT_LIST from logcfg.dat */
/* check if continent is in CONTINENT_LIST */
bool is_in_continentlist(char *continent) {
int i = 0;

Expand All @@ -112,8 +111,7 @@ bool is_in_continentlist(char *continent) {
}


/* apply bandweight scoring *
* at the moment only LOWBAND_DOUBLES (<30m) can be active */
/* apply bandweight scoring */
int apply_bandweight(int points, int bandindex) {

if (lowband_point_mult && (bandindex < BANDINDEX_30))
Expand Down Expand Up @@ -148,53 +146,38 @@ int scoreByMode(struct qso_t *qso) {
}
}

/* Overwrite points with x if set */
#define USE_IF_SET(x) do { \

/* return x points if set */
#define RETURN_IF_SET(x) do { \
if (x >= 0) \
points = x; \
return x; \
} while(0);

int scoreByContinentOrCountry(struct qso_t *qso) {

int points = 0;
prefix_data *ctyinfo = getctyinfo(qso->call);
bool inCountryList = is_in_countrylist(ctyinfo->dxcc_ctynr);

if (countrylist_only) {
points = 0;
if (inCountryList)
USE_IF_SET(countrylist_points);
if (ctyinfo->dxcc_ctynr == my.countrynr) {
RETURN_IF_SET(my_country_points);
}

return points;
if (inCountryList) {
RETURN_IF_SET(countrylist_points);
}

/* HA2OS mods */
if (continentlist_only) {
points = 0;
// only continent list allowed
if (is_in_continentlist(ctyinfo->continent)) {
USE_IF_SET(continentlist_points);
// overwrite if own continent and my_cont_points set
if (strcmp(ctyinfo->continent, my.continent) == 0) {
USE_IF_SET(my_cont_points);
}
}
return points;
if (strcmp(ctyinfo->continent, my.continent) == 0) {
RETURN_IF_SET(my_cont_points);
}

// default
if (ctyinfo->dxcc_ctynr == my.countrynr) {
points = 0;
USE_IF_SET(my_cont_points);
USE_IF_SET(my_country_points);
} else if (inCountryList) {
USE_IF_SET(countrylist_points);
} else if (strcmp(ctyinfo->continent, my.continent) == 0) {
USE_IF_SET(my_cont_points);
} else
USE_IF_SET(dx_cont_points);
if (is_in_continentlist(ctyinfo->continent)) {
RETURN_IF_SET(continentlist_points);
}

return points;
if (strcmp(ctyinfo->continent, my.continent) != 0) {
RETURN_IF_SET(dx_cont_points);
}
return 0;
}


Expand Down
2 changes: 0 additions & 2 deletions test/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,11 @@ int my_country_points = -1;
int my_cont_points = -1;
int dx_cont_points = -1;
char countrylist[255][6];
bool countrylist_only = false;
int countrylist_points = -1;
char continent_multiplier_list[7][3]; // SA, NA, EU, AF, AS and OC
int continentlist_points = -1;
bool continentlist_only = false;
int exclude_multilist_type = EXCLUDE_NONE;
bool mult_side = false;
/* end LZ3NY mods */

bool portable_x2 = false;
Expand Down
2 changes: 2 additions & 0 deletions test/rules/spdx_dx/logcfg.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
RULES=spdx_dx
CALL=N0CALL
1 change: 1 addition & 0 deletions test/rules/spdx_dx/rules/spdx_dx
5 changes: 5 additions & 0 deletions test/rules/spdx_dx/spdx.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
40CW 28-Jul-26 19:21 0001 SP1AAA 599 599 B B 3 7012.0
40CW 28-Jul-26 19:21 0002 SP2BBB 599 599 C C 3 7012.0
40CW 28-Jul-26 19:21 0003 SP3CCC 599 599 D D 3 7012.0
40SSB 28-Jul-26 19:21 0004 SP4DDD 599 599 C 3 7012.0
40CW 28-Jul-26 19:37 0005 PA5EEE 599 599 324 0 7012.0
1 change: 1 addition & 0 deletions test/rules/spdx_dx/spdxmults
2 changes: 0 additions & 2 deletions test/test_addcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ int setup_default(void **state) {
strcpy(countrylist[1], "CE");
strcpy(countrylist[2], "");

countrylist_only = false;

strcpy(continent_multiplier_list[0], "EU");
strcpy(continent_multiplier_list[1], "NA");
strcpy(continent_multiplier_list[2], "");
Expand Down
18 changes: 0 additions & 18 deletions test/test_parse_logcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ int setup_default(void **state) {
using_named_nodes = false;
xplanet = MARKER_NONE;
dx_arrlsections = false;
mult_side = false;
countrylist_points = -1;
my_country_points = -1;
my_cont_points = -1;
Expand Down Expand Up @@ -1153,7 +1152,6 @@ void test_countrylist(void **state) {
assert_string_equal(countrylist[1], "GM");
assert_string_equal(countrylist[2], "F");
assert_string_equal(countrylist[3], "");
assert_true(mult_side);
assert_int_equal(CONTEST_IS(UNKNOWN), 1);
}

Expand All @@ -1171,7 +1169,6 @@ void test_countrylist_long(void **state) {
assert_string_equal(countrylist[128], "VU");
assert_string_equal(countrylist[160], "ZS8");
assert_string_equal(countrylist[161], "");
assert_false(mult_side);
assert_int_equal(CONTEST_IS(UNKNOWN), 1);
}

Expand All @@ -1183,7 +1180,6 @@ void test_countrylist_from_file(void **state) {
assert_string_equal(countrylist[0], "EA");
assert_string_equal(countrylist[1], "CT");
assert_string_equal(countrylist[2], "");
assert_true(mult_side);
assert_int_equal(CONTEST_IS(UNKNOWN), 1);
}

Expand All @@ -1203,7 +1199,6 @@ void test_countrylist_from_file_long(void **state) {
assert_string_equal(countrylist[128], "VU");
assert_string_equal(countrylist[160], "ZS8");
assert_string_equal(countrylist[161], "");
assert_true(mult_side);
assert_int_equal(CONTEST_IS(UNKNOWN), 1);
}

Expand All @@ -1213,19 +1208,6 @@ void test_countrylist_points(void **state) {
assert_int_equal(countrylist_points, 4);
}

void test_countrylist_only(void **state) {
int rc = call_parse_logcfg("USE_COUNTRYLIST_ONLY\n");
assert_int_equal(rc, PARSE_OK);
assert_true(countrylist_only);
}

void test_countrylist_only_mult_side(void **state) {
mult_side = true;
int rc = call_parse_logcfg("USE_COUNTRYLIST_ONLY\n");
assert_int_equal(rc, PARSE_OK);
assert_false(countrylist_only);
}

void test_my_country_points(void **state) {
int rc = call_parse_logcfg("MY_COUNTRY_POINTS=4\n");
assert_int_equal(rc, PARSE_OK);
Expand Down
Loading