Skip to content

Commit

Permalink
update HS contest
Browse files Browse the repository at this point in the history
  • Loading branch information
JG1VPP committed May 4, 2024
1 parent e036cf9 commit 6de444b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/plugins/rules/hstest/hstest.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import (
)

var hsmults int
var hstable map[string]int

//go:embed hstest.dat
var cityMultiList string

func init() {
hstable = make(map[string]int)
reiwa.CityMultiList = cityMultiList
reiwa.OnAssignEvent = onAssignEvent
reiwa.OnInsertEvent = onInsertEvent
Expand All @@ -27,17 +29,29 @@ func init() {

func onAssignEvent(contest, configs string) {
hsmults = 0
clear(hstable)
}

func onInsertEvent(qso *reiwa.QSO) {
if qso.GetMul2() == "HS" {
hsmults += 1
call := qso.GetCall()
if n, ok := hstable[call]; ok {
hsmults += 1
hstable[call] = n + 1
} else {
hstable[call] = 1
}
}
}

func onDeleteEvent(qso *reiwa.QSO) {
if qso.GetMul2() == "HS" {
hsmults -= 1
if n := hstable[call]; n <= 1 {
hsmults -= 1
delete(hstable[call])
} else {
hstable[call] = n - 1
}
}
}

Expand Down

0 comments on commit 6de444b

Please sign in to comment.