Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor - introduce contest-specific message handling #185

Merged

Conversation

w7sst
Copy link
Owner

@w7sst w7sst commented Feb 13, 2023

Added new virtual method to TContest.SendMsg(). This is derived by those contests with contest-specific messaging. Codes was moved from its old location into the new methods. No functionality was changed - only code movement. This fixes #184.

I like this change. It removes lots of case statements. Here is an example from ARRL Field Day...

{
  Overrides TContest.SendMsg() to send contest-specific messages.

  Adding a contest: TContest.SendMsg(AMsg): send contest-specfic messages
}
procedure TArrlFieldDay.SendMsg(const AStn: TStation; const AMsg: TStationMessage);
begin
  case AMsg of
    msgCQ: SendText(AStn, 'CQ FD <my>');
    msgNrQm:
      case Random(5) of
        0,1: SendText(AStn, 'NR?');
        2: SendText(AStn, 'SECT?');
        3: SendText(AStn, 'CLASS?');
        4: SendText(AStn, 'CL?');
      end;
    msgLongCQ: SendText(AStn, 'CQ CQ FD <my> <my> FD');  // QrmStation only
    else
      inherited SendMsg(AStn, AMsg);
  end;
end;

Note - I added many people to this review to keep people informed of the design change. My next step is to integrate the SST Contest.

@w7sst w7sst self-assigned this Feb 13, 2023
@w7sst w7sst linked an issue Feb 13, 2023 that may be closed by this pull request
@w7sst w7sst merged commit 9fcc8a7 into main Feb 15, 2023
@w7sst w7sst deleted the 184-refactor-introduce-contest-specific-message-handling-logic branch February 15, 2023 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor - introduce contest-specific message handling logic
2 participants