]> git.pond.sub.org Git - empserver/commitdiff
(rea): Set parameters for read to [yes|no|<CNUM/CNAME>].
authorRon Koenderink <rkoenderink@yahoo.ca>
Fri, 25 Mar 2005 21:04:39 +0000 (21:04 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Fri, 25 Mar 2005 21:04:39 +0000 (21:04 +0000)
Add parameters for read in the command list and the info pages.
Closes #1010010.

info/Commands/read.t
src/lib/commands/rea.c
src/lib/player/empmod.c

index 5167ba8bb8c64807ee25e1d2f0def6cbb3310c8a..643fad9803a80ba73ed6fd380d8c20beec8dbb6a 100644 (file)
@@ -1,20 +1,28 @@
 .TH Command READ
 .NA read "Read your telegrams"
 .LV Basic
-.SY "read"
+.SY "read [yes|no|<CNUM/CNAME>]"
 The read command is used to read the telegrams sent you
 by other countries and by the game,
 (e.g. when you make a sale or are attacked).
 .sp
+After reading all your telegrams you may delete them by 
+specifying \*Qyes\*U or not by specifying \*Qno\*U as an argument.
+If an argument is not supplied then you will be prompted
+to either answer \*Qyes\*U or \*Qno\*U to delete the telegrams.
+If you supply or answer \*Qno\*U, the telegrams will remain
+pending but you will not be reminded of them.
+.sp
+Deities can specify a <CNUM/CNAME> argument which
+selects a country's telegrams to read.
+If the <CNUM/CNAME> argument is supplied, the telegrams can not be deleted.
+.sp
 When telegrams arrive you are informed with:
 .NF
 \*QYou have a new telegram waiting ...\*U   if there is just one new one, or
 \*QYou have ten new telegrams waiting ...\*U   if there are ten of them, or
 \*QYou have several new telegrams waiting ...\*U   if there are very many.
 .FI
-After reading all your telegrams you may discard them by answering \*Qyes\*U to
-the question posed.  If you answer \*Qno\*U the telegrams will remain
-pending but you will not be reminded of them.
 .s1
 This command reads only
 telegrams & bulletins, use the 'wire' command to read announcements.
index 3465caea6ac1f092bdf324778e8f6d65acadeb83..e319eb78816b646566d674d9b5e10e0a1e61d1dd 100644 (file)
@@ -40,6 +40,7 @@
 #include "tel.h"
 #include "commands.h"
 #include "optlist.h"
+#include "match.h"
 
 #include <stdio.h>
 #include <fcntl.h>
@@ -77,24 +78,29 @@ rea(void)
     time_t delta;
     int first = 1;
     int readit;
+    int may_delete = 1; /* may messages be deleted? */
 
     memset(kind, 0, sizeof(kind));
     now = time(NULL);
 
     if (*player->argp[0] == 'w') {
-       sprintf(kind, "announcement");
+       strcpy(kind, "announcement");
        if (player->argp[1] && isdigit(*player->argp[1])) {
            delta = days(atoi(player->argp[1]));
            then = now - delta;
+           may_delete = 0;
        } else
            then = np->nat_annotim;
        mbox = annfil;
     } else {
-       sprintf(kind, "telegram");
-       if (player->god && player->argp[1] != 0) {
+       strcpy(kind, "telegram");
+       if (player->god && player->argp[1] &&
+           (mineq(player->argp[1], "yes") == ME_MISMATCH) &&
+           (mineq(player->argp[1], "no") == ME_MISMATCH)) {
            if ((n = natarg(player->argp[1], "")) < 0)
                return RET_SYN;
            num = n;
+           may_delete = 0;
        }
        mbox = mailbox(mbox_buf, num);
        clear_telegram_is_new(player->cnum);
@@ -167,7 +173,7 @@ rea(void)
        }
     }
     p = NULL;
-    if (teles > 0 && player->cnum == num) {    /* } */
+    if (teles > 0 && player->cnum == num && may_delete) {
        pr("\n");
        if (teles == 1) {
            if (chance(0.25))
@@ -180,10 +186,7 @@ rea(void)
            else
                p = "Can I throw away these old love letters? ";
        }
-       if (player->god && *kind == 't')
-           p = getstarg(player->argp[2], p, buf);
-       else
-           p = getstarg(player->argp[1], p, buf);
+       p = getstarg(player->argp[1], p, buf);
        if (p && *p == 'y') {
            if ((filelen = fsize(fileno(telfp))) > size) {
                pr("Wait a sec!  A new %s has arrived...\n", kind);
index ffd98ba5bc321031517201c5a46a24efdfd5c7e2..d9e6bb58be94c3d71bf814432f999db54ae15005 100644 (file)
@@ -192,7 +192,7 @@ struct cmndstr player_coms[] = {
     {"quit", 0, quit, 0, VIS},
     {"radar <SHIPS | SECTS>", 1, rada, 0, NORM + CAP},
     {"range <PLANES> <range>", 1, range, C_MOD, NORM + CAP},
-    {"read", 0, rea, C_MOD, VIS},
+    {"read [yes|no|<CNUM/CNAME>]", 0, rea, C_MOD, VIS},
     {"realm <number> [<SECTS>]", 0, real, C_MOD, NORM},
     {"recon <spy-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION>", 3,
      reco, C_MOD, NORM + MONEY + CAP},