{$M $4000,0,0 }   { 16K stack, no heap }

Program MSCMenu;



uses

  Dos,

  Crt;



const

  Forever: boolean = false;



var

  ContKey: char;

  emfile,

  dufile,

  gafile,

  gmfile: text;



  var

    ProgramName, CmdLine: string;



{***************************************************************************}

procedure LoadChild;

begin

  SwapVectors;

  Exec(ProgramName, CmdLine);

  SwapVectors;

  if DosError <> 0 then{ Error? }

    WriteLn('Dos error #', DosError)

end;





{***************************************************************************}

procedure ADandD;

const

  stop:boolean = true;

var

  ch: char;

begin

 repeat

  clrscr;

  writeln('1) DMHelper');

  writeln('2) Character Generator (1st Edition rules)');

  writeln;

  ch := readkey;

  if ch = '1' then

    begin

      ProgramName := 'd:\dmhelper.exe';

      CmdLine := '';

      LoadChild;

    end

  else

    if ch = '2' then halt

    else

      begin

        writeln(#7);

        Stop := false;

      end;

 until Stop;

end;



{***************************************************************************}

Procedure InitFiles;

var

  s: pathstr;

begin

  assign(emfile, 'D:\EMail.DTA');

  s := FSearch('EMail.DTA', 'D:\');

  if s = '' then

    begin

      rewrite(emfile);

      close(emfile);

    end;

  assign(dufile, 'D:\Dues.Dta');

  s := FSearch('Dues.Dta', 'D:\');

  if s = '' then

    begin

      rewrite(dufile);

      close(dufile);

    end;

  assign(gafile, 'D:\Games.Dta');

  s := FSearch('Games.Dta', 'D:\');

  if s = '' then

    begin

      rewrite(gafile);

      close(gafile);

    end;

  assign(gmfile, 'D:\Masters.Dta');

  s := FSearch('Masters.Dta', 'D:\');

  if s = '' then

    begin

      rewrite(gmfile);

      close(gmfile);

    end;

end;



{***************************************************************************}

Procedure RPGA;

var

  ContKey: char;

begin

  clrscr;

  writeln('The RPGA Network is an international organization of gaming enthusiasts');

  writeln('dedicated to excellence in role-playing games.  If you''re looking for ');

  writeln('Gamers who share your interest in role-playing games, and if you want');

  writeln('to know more about what''s coming from TSR, Inc., join the RPGA Network.');

  writeln('Benifits include:');

  writeln('Membership pin, certificate, ID card (with player and judge rankings)');

  writeln('One-year subscription to Polyhedron Newszine');

  writeln('10% discount from Mail Order Hobby Shop Catalog');

  writeln('Info on how to start a local RPGA Network Club');

  writeln('Info on how you can participate in Ravens Bluff, the Living City.');

  writeln;

  writeln('Press any key to continue...');

  ContKey := readkey;

end;



{***************************************************************************}

Procedure ListDues;

var

  last,

  first: string;

  squad,

  class: string;

begin

  reset(dufile);

  while not(eof(dufile)) do

    begin

      readln(dufile, last);

      readln(dufile, first);

      readln(dufile, squad);

      readln(dufile, class);

      writeln('Name:  ',last,', ', first,', Squadron:  ',squad,', Class:  ',class);

    end;

  writeln;

  writeln('Press any key to continue...');

  ContKey := readkey;

  close(dufile);

end;



{***************************************************************************}

Procedure Dues;

const

  stop: boolean = false;

var

  Lastname: string;

  Firstname: string;

  Squadron: string;

  Class: string;

  Ch: char;

begin

  repeat

  clrscr;

  writeln('Club dues are $10.  This money will be deducted from your');

  writeln('magic money account automatically.  The club receives a budget');

  writeln('every semester from A-Hall.  We plan to spend the remainder');

  writeln('of last year''s budget on purchasing Role-Playing Game');

  writeln('Association (RPGA) memberships worth $15 for those who pay');

  writeln('their dues.  This is not final.  You will be contacted to confirm');

  writeln('your decision and decide whether to take the RPGA membership or');

  writeln('give an extra $24 to get a subscription to Dragon magazine with');

  writeln('your RPGA membership (save $6 off of Dragon).');

  writeln;

  writeln('1)  List those already signed up');

  writeln('2)  Get a description of the RPGA');

  writeln('3)  Put your name on the list to pay dues');

  writeln('4)  Exit back to the previous menu');

  writeln;

  Ch := readkey;

  case ch of

    '1':  ListDues;

    '2':  RPGA;

    '3':  begin

            write('What is your last name?:  ');

            readln(lastname);

            write('What is your first name?:  ');

            readln(firstname);

            write('What is your squadron number?:  ');

            readln(squadron);

            write('What if your class number?:  ');

            readln(class);

            append(dufile);

            writeln(dufile, lastname);

            writeln(dufile, firstname);

            writeln(dufile, squadron);

            writeln(dufile, class);

            close(dufile);

          end;

    '4':  stop := true;

    else

      writeln(#7);

  end; {case}

  until stop;

end;



{***************************************************************************}

Procedure ListGames;

const

  count: integer = 0;

var

  last,

  first: string;

  squad,

  class: string;

  gamesplayed: string;

begin

  reset(gafile);

  while not(eof(gafile)) do

    begin

      count := count + 1;

      readln(gafile, last);

      readln(gafile, first);

      readln(gafile, squad);

      readln(gafile, class);

      readln(gafile, gamesplayed);

      writeln('Name:  ',last,', ', first,', Squadron:  ',squad,', Class:  ',class);

      writeln('Games:  ', gamesplayed);

      writeln;

      if (count/7) = int(count/7) then

        begin

          writeln('Press any key to continue...');

          ContKey := readkey;

        end;

    end;

  writeln;

  writeln('Press any key to continue...');

  ContKey := readkey;

  close(gafile);

end;



{***************************************************************************}

Procedure Games;

const

  stop: boolean = false;

var

  Lastname: string;

  Firstname: string;

  Squadron: string;

  Class: string;

  GamesPlayed: string;

  Ch: char;

begin

  repeat

  clrscr;

  writeln('1)  List those the games that people within the club play');

  writeln('2)  Add your name and games to the list');

  writeln('3)  Exit back to the previous menu');

  writeln;

  Ch := readkey;

  case ch of

    '1':  ListGames;

    '2':  begin

            write('What is your last name?:  ');

            readln(lastname);

            write('What is your first name?:  ');

            readln(firstname);

            write('What is your squadron number?:  ');

            readln(squadron);

            write('What if your class number?:  ');

            readln(class);

            writeln('What games do you play?:  ');

            readln(gamesplayed);

            append(gafile);

            writeln(gafile, lastname);

            writeln(gafile, firstname);

            writeln(gafile, squadron);

            writeln(gafile, class);

            writeln(gafile, gamesplayed);

            close(gafile);

          end;

    '3':  stop := true;

    else

      writeln(#7);

  end; {case}

  until stop;

end;



{***************************************************************************}

Procedure ListDMs;

const

  count: integer = 0;

var

  last,

  first: string;

  squad,

  class: string;

  gamesDMed: string;

begin

  reset(gmfile);

  while not(eof(gmfile)) do

    begin

      count := count + 1;

      readln(gmfile, last);

      readln(gmfile, first);

      readln(gmfile, squad);

      readln(gmfile, class);

      readln(gmfile, gamesDMed);

      writeln('Name:  ',last,', ', first,', Squadron:  ',squad,', Class:  ',class);

      writeln('Games:  ', gamesDMed);

      writeln;

      if (count/7) = int(count/7) then

        begin

          writeln('Press any key to continue...');

          ContKey := readkey;

        end;

    end;

  writeln;

  writeln('Press any key to continue...');

  ContKey := readkey;

  close(gmfile);

end;



{***************************************************************************}

Procedure DMs;

const

  stop: boolean = false;

var

  Lastname: string;

  Firstname: string;

  Squadron: string;

  Class: string;

  GamesDMed: string;

  Ch: char;

begin

  repeat

  clrscr;

  writeln('1)  List those the Game Masters/Referees and the games that they judge');

  writeln('2)  Add your name and games to the list');

  writeln('3)  Exit back to the previous menu');

  writeln;

  Ch := readkey;

  case ch of

    '1':  ListDMs;

    '2':  begin

            write('What is your last name?:  ');

            readln(lastname);

            write('What is your first name?:  ');

            readln(firstname);

            write('What is your squadron number?:  ');

            readln(squadron);

            write('What if your class number?:  ');

            readln(class);

            writeln('What games do you judge?:  ');

            readln(gamesDMed);

            append(gmfile);

            writeln(gmfile, lastname);

            writeln(gmfile, firstname);

            writeln(gmfile, squadron);

            writeln(gmfile, class);

            writeln(gmfile, gamesDMed);

            close(gmfile);

          end;

    '3':  stop := true;

    else

      writeln(#7);

  end; {case}

  until stop;

end;



{***************************************************************************}

Procedure ListEmail;

var

  last,

  first: string;

  squad,

  class: string;

begin

  reset(emfile);

  while not(eof(emfile)) do

    begin

      readln(emfile, last);

      readln(emfile, first);

      readln(emfile, squad);

      readln(emfile, class);

      writeln('Name:  ',last,', ', first,', Squadron:  ',squad,', Class:  ',class);

    end;

  writeln;

  writeln('Press any key to continue...');

  ContKey := readkey;

  close(emfile);

end;



{***************************************************************************}

Procedure EmailList;

var

  Lastname: string;

  Firstname: string;

  Squadron: string;

  Class: string;

  Ch: char;

const

  Stop: boolean = false;

begin

  repeat

      clrscr;

      writeln('The MSC keeps in touch with its members mainly through the');

      writeln('use of E-mail.  Usually, games arranged to be played on the');

      writeln('weekend will be posted on e-mail by Thursday.  If your name');

      writeln('is not on the e-mail list, there is no guarantee that we''ll');

      writeln('get in touch with you about upcoming activities.');

      writeln;

      writeln('1)  List those who have signed up today');

      writeln('2)  Add your name to the list');

      writeln('3)  Return to the previous menu');

      Ch := readkey;

      case Ch of

        '1':  ListEmail;

        '2':  begin

                writeln;

                write('What is your last name?:  ');

                readln(lastname);

                write('What is your first name?:  ');

                readln(firstname);

                write('What is your squadron number?:  ');

                readln(squadron);

                write('What if your class number?:  ');

                readln(class);

                append(emfile);

                writeln(emfile, lastname);

                writeln(emfile, firstname);

                writeln(emfile, squadron);

                writeln(emfile, class);

                close(emfile);

              end;

        '3':  Stop := true;

        else

          write(#7);

      end; {case}

  until Stop;

end;



{***************************************************************************}

{***************************************************************************}

{***************************************************************************}

var

  Ch: char;

begin

  InitFiles;

  repeat

    clrscr;

    writeln('  The Military Science Club (MSC) is the Academy wargaming club.');

    writeln('We bring people together to play role-playing games, miniatures');

    writeln('warfare, board games, and computer games.  We insure that the');

    writeln('club members get the best deals available and participate in');

    writeln('regional events (conventions, etc.).');

    writeln;

    writeln('1)  See programs written for Advanced Dungeons & Dragons');

    writeln('2)  Consider putting your name on a list to receive e-mail over FalcoNet');

    writeln('      concerning MSC activities');

    writeln('3)  Consider putting your name on a list to have $10 taken from your magic');

    writeln('      money to cover MSC dues (and get a free RPGA membership');

    writeln('      for one year worth $15)');

    writeln('4)  See a list of who plays what games and/or add your name');

    writeln('      and your favorite games to that list.');

    writeln('5)  See a list of who gamemasters/referees what games and/or');

    writeln('      add your name to that list.');

    writeln;

    Ch := readkey;

    case Ch of

      '1': ADandD;

      '2':  EmailList;

      '3':  Dues;

      '4':  Games;

      '5':  DMs;

      else

        write(#7);

    end; {case}

  until Forever;

end.