Skip to content

Commit

Permalink
Rename variable and make it bool, change broken comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dl1jbe committed Nov 17, 2021
1 parent 186ebcf commit 842feaf
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
32 changes: 16 additions & 16 deletions src/addcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
#include "tlf.h"
#include "zone_nr.h"

int excl_add_veto;
/* This variable helps to handle in other modules, that station is multiplier
bool add_veto;
/* This variable helps other modules in handling, if station is a multiplier
* or not */
/* In addcall2(), this variable helps to handle the excluded multipliers,
* which came from lan_logline the Tlf scoring logic is totally completely
* different in local and LAN source the addcall() function doesn't increment
* the band_score[] array, that maintains the score() function. Here, the
* addcall2() is need to separate the points and multipliers.
/* In addcall_lan(), this variable helps to handle the excluded multipliers,
* which came from lan_logline. The Tlf scoring logic is totally completely
* different in local and LAN source. The addcall() function doesn't increment
* the band_score[] array, that remains the task of the score() function.
* Here, addcall_lan() needs to separate the points and multipliers.
*/


Expand Down Expand Up @@ -124,7 +124,7 @@ void addcall(struct qso_t *qso) {
int pfxnumcntidx = -1;
int pxnr = 0;

excl_add_veto = 0;
add_veto = false;

int station = lookup_or_add_worked(qso->call);
update_worked(station, qso);
Expand Down Expand Up @@ -164,12 +164,12 @@ void addcall(struct qso_t *qso) {

if (continentlist_only) {
if (!is_in_continentlist(dxcc_by_index(cty)->continent)) {
excl_add_veto = 1;
add_veto = true;
}
}

excl_add_veto |= check_veto(cty);
if (excl_add_veto) {
add_veto |= check_veto(cty);
if (add_veto) {
add_ok = false;
new_cty = 0;
new_zone = 0;
Expand Down Expand Up @@ -220,7 +220,7 @@ void addcall_lan(void) {
int bandinx;
int pfxnumcntidx = -1;
int pxnr = 0;
excl_add_veto = 0;
add_veto = false;

/* parse copy of lan_logline */
struct qso_t *qso;
Expand Down Expand Up @@ -270,12 +270,12 @@ void addcall_lan(void) {

if (continentlist_only) {
if (!is_in_continentlist(dxcc_by_index(cty)->continent)) {
excl_add_veto = 1;
add_veto = true;
}
}

excl_add_veto |= check_veto(cty);
if (excl_add_veto) {
add_veto |= check_veto(cty);
if (add_veto) {
add_ok = false;
new_cty = 0;
addcallarea = 0;
Expand All @@ -287,7 +287,7 @@ void addcall_lan(void) {

worked[station].band |= inxes[bandinx]; /* worked on this band */

if (excl_add_veto == 0) {
if (!add_veto) {

if (pfxnumcntidx < 0) {
if (cty != 0 && (countries[cty] & inxes[bandinx]) == 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/addcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "tlf.h"

extern int excl_add_veto;
extern bool add_veto;

struct qso_t *collect_qso_data(void);
bool check_veto(int countrynr);
Expand Down
2 changes: 1 addition & 1 deletion src/makelogline.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ void prepare_specific_part(void) {
/* If WPX
* -> add prefix to prefixes_worked and include new pfx in log line */
new_pfx = 0;
if (!(pfxmultab == 1 && excl_add_veto == 1)) {
if (!(pfxmultab == 1 && add_veto)) {
/* add prefix, remember if new */
new_pfx = (add_pfx(wpx_prefix, bandinx) == 0);
}
Expand Down
24 changes: 12 additions & 12 deletions test/test_addcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ void test_addcall_continentlistonly(void **state) {
current_qso = collect_qso_data();
addcall(current_qso);

assert_int_equal(excl_add_veto, false);
assert_int_equal(add_veto, false);
strcpy(hiscall, "PY2BBB");

current_qso = collect_qso_data();
addcall(current_qso);

assert_int_equal(excl_add_veto, true);
assert_int_equal(add_veto, true);
}

void test_addcall_exclude_continent(void **state) {
Expand All @@ -236,13 +236,13 @@ void test_addcall_exclude_continent(void **state) {
current_qso = collect_qso_data();
addcall(current_qso);

assert_int_equal(excl_add_veto, true);
assert_int_equal(add_veto, true);
strcpy(hiscall, "PY2BBB");

current_qso = collect_qso_data();
addcall(current_qso);

assert_int_equal(excl_add_veto, false);
assert_int_equal(add_veto, false);
}

void test_addcall_exclude_country(void **state) {
Expand All @@ -252,13 +252,13 @@ void test_addcall_exclude_country(void **state) {
current_qso = collect_qso_data();
addcall(current_qso);

assert_int_equal(excl_add_veto, false);
assert_int_equal(add_veto, false);
strcpy(hiscall, "DL1AAA");

current_qso = collect_qso_data();
addcall(current_qso);

assert_int_equal(excl_add_veto, true);
assert_int_equal(add_veto, true);
}


Expand Down Expand Up @@ -593,29 +593,29 @@ void test_addcall_lan_continentlistonly(void **state) {
continentlist_only = true;
strcpy(lan_logline, logline_PY);
addcall_lan();
assert_int_equal(excl_add_veto, true);
assert_int_equal(add_veto, true);
strcpy(lan_logline, logline);
addcall_lan();
assert_int_equal(excl_add_veto, false);
assert_int_equal(add_veto, false);
}

void test_addcall_lan_exclude_continent(void **state) {
exclude_multilist_type = EXCLUDE_CONTINENT;
strcpy(lan_logline, logline);
addcall_lan();
assert_int_equal(excl_add_veto, true);
assert_int_equal(add_veto, true);
strcpy(lan_logline, logline_PY);
addcall_lan();
assert_int_equal(excl_add_veto, false);
assert_int_equal(add_veto, false);
}

void test_addcall_lan_exclude_country(void **state) {
exclude_multilist_type = EXCLUDE_COUNTRY;
strcpy(lan_logline, logline);
addcall_lan();
assert_int_equal(excl_add_veto, false);
assert_int_equal(add_veto, false);
strcpy(lan_logline, logline_DL);
addcall_lan();
assert_int_equal(excl_add_veto, true);
assert_int_equal(add_veto, true);
}

0 comments on commit 842feaf

Please sign in to comment.