Skip to content

Commit

Permalink
Add additional 'Adding a contest' comments. (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
w7sst committed Oct 11, 2022
1 parent 90cf79d commit 813ae51
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions DxStn.pas
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,15 @@ procedure TDxStation.DataToLastQso;
TrueCall := Self.MyCall;
TrueRst := Self.Rst;
TrueNR := Self.NR;
// Adding a contest: copy DxStation's Exch1 qso information into log
case ActiveContest.ExchType1 of
etRST: TrueExch1 := IntToStr(Self.NR);
etOpName: TrueExch1 := Self.OpName;
etFdClass: TrueExch1 := Self.Exch1;
else
assert(false);
end;
// Adding a contest: copy DxStation's Exch2 qso information into log
case ActiveContest.ExchType2 of
etSerialNr: TrueExch2 := IntToStr(Self.NR);
etCwopsNumber: TrueExch2 := IntToStr(Self.NR);
Expand Down
4 changes: 3 additions & 1 deletion Ini.pas
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ interface

DEFAULTWEBSERVER = 'http://www.dxatlas.com/MorseRunner/MrScore.asp';
type
// Adding a contest: Append new TSimContest enum value for each contest.
// Adding a contest: update menu in Main.dfm.
TSimContest = (scWpx, scCwt, scFieldDay, scNaQp, scHst);
TRunMode = (rmStop, rmPileup, rmSingle, rmWpx, rmHst);

Expand Down Expand Up @@ -55,7 +57,7 @@ TContestDefinition = record
Note: The order of this table must match the declared order of
TSimContest above.
Adding a contest: Add to TSimContest enum (above) and update ContestDefinitions[] array.
Adding a contest: update ContestDefinitions[] array. (append at end until sorting is added)
}
ContestDefinitions: array[TSimContest] of TContestDefinition = (
(Name: 'CQ Wpx';
Expand Down
4 changes: 4 additions & 0 deletions Log.pas
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ procedure SaveQso;
i: integer;
Qso: PQso;

// Adding a contest: validate contest-specific exchange fields
//validate Exchange 1 (Edit2) field lengths
function ValidateExchField1(const text: string): Boolean;
begin
Expand Down Expand Up @@ -453,6 +454,7 @@ procedure SaveQso;
Qso.T := BlocksToSeconds(Tst.BlockNumber) / 86400;
Qso.Call := StringReplace(Edit1.Text, '?', '', [rfReplaceAll]);

// Adding a contest: save contest-specific exchange values into QsoList
//save Exchange 1 (Edit2)
case ActiveContest.ExchType1 of
etRST: Qso.Rst := StrToInt(Edit2.Text);
Expand Down Expand Up @@ -571,6 +573,7 @@ procedure CheckErr;
if Err.IsEmpty and Dupe then
Err := 'DUP';
if Err.IsEmpty then
// Adding a contest: check for contest-specific exchange field 1 errors
case ActiveContest.ExchType1 of
etRST: if TrueRst <> Rst then Err := 'RST';
etOpName: if TrueExch1 <> Exch1 then Err := 'NAME';
Expand All @@ -579,6 +582,7 @@ procedure CheckErr;
assert(false, 'missing exchange 1 case');
end;
if Err.IsEmpty then
// Adding a contest: check for contest-specific exchange field 2 errors
case ActiveContest.ExchType2 of
etSerialNr: if TrueNr <> NR then Err := 'NR ';
etCwopsNumber: if TrueNr <> NR then Err := 'NR ';
Expand Down
5 changes: 5 additions & 0 deletions Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ TFieldDefinition = record
PFieldDefinition = ^TFieldDefinition;

const
// Adding a contest: define contest-specific field types
// Exchange Field 1 settings/rules
Exchange1Settings: array[TExchange1Type] of TFieldDefinition = (
(C: 'RST'; R: '5[9N][9N]'; L: 3; T:Ord(etRST)),
Expand Down Expand Up @@ -436,6 +437,7 @@ procedure TMainForm.FormCreate(Sender: TObject);
Tst := TContest.Create;
LoadCallList;

// Adding a contest: implement a new contest-specific call history .pas file.
// Adding a contest: load call history file (be sure to delete it below).
ARRLDX:= TARRL.Create;
gARRLFD := TArrlFieldDay.Create;
Expand Down Expand Up @@ -849,6 +851,7 @@ procedure TMainForm.ExchangeEditExit(Sender: TObject);

procedure TMainForm.SetContest(AContestNum: TSimContest);
begin
// Adding a contest: add each contest to this set. TODO - implement alternative
// validate selected contest
if not (AContestNum in [scWpx, scCwt, scFieldDay, scNaQp, scHst]) then
begin
Expand Down Expand Up @@ -1011,6 +1014,7 @@ procedure TMainForm.ConfigureExchangeFields(
procedure TMainForm.SetMyExch1(const AExchType: TExchange1Type;
const Avalue: string);
begin
// Adding a contest: setup contest-specific exchange field 1
case AExchType of
etRST:
begin
Expand Down Expand Up @@ -1044,6 +1048,7 @@ procedure TMainForm.SetMyExch2(const AExchType: TExchange2Type;
var
i: integer;
begin
// Adding a contest: setup contest-specific exchange field 2
case AExchType of
etSerialNr:
begin
Expand Down

0 comments on commit 813ae51

Please sign in to comment.