]> git.pond.sub.org Git - empserver/commitdiff
Permit flash to yourself
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 5 Feb 2011 11:50:50 +0000 (12:50 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 13 Feb 2011 15:39:20 +0000 (16:39 +0100)
Flashing yourself failed with a bogus "not logged on" message for
deities, and a mildly bogus "not a deity or friendly with us" message
for mortals.

Fix by simply permitting it.  Not terribly useful, except perhaps for
empire-hub users, but why not.

src/lib/commands/flash.c

index d1aaa2d097733bec1b0c85dbd15329df8de6e8f2..ffdba7a517a733d7a2c2a6a0d7db8ea10e1a5b42 100644 (file)
@@ -63,7 +63,8 @@ flash(void)
        }
     } else {
        /* Ok, we are a normal country, can we flash them? */
-       if (to->nat_stat != STAT_GOD && getrel(to, player->cnum) < FRIENDLY) {
+       if (to->nat_stat != STAT_GOD && tocn != player->cnum
+           && getrel(to, player->cnum) < FRIENDLY) {
            pr("%s is not a deity or friendly with us.\n", to->nat_cnam);
            return RET_SYN;
        }
@@ -127,8 +128,6 @@ sendmessage(struct natstr *to, char *message, int verbose)
     for (other = player_next(NULL); other; other = player_next(other)) {
        if (other->state != PS_PLAYING)
            continue;
-       if (player == other)
-           continue;
        if (to) {
            /* flash */
            if (other->cnum != to->nat_cnum)
@@ -136,6 +135,8 @@ sendmessage(struct natstr *to, char *message, int verbose)
            wto = to;
        } else {
            /* wall */
+           if (player == other)
+               continue;
            wto = getnatp(other->cnum);
            if (CANT_HAPPEN(!wto))
                continue;
@@ -165,7 +166,8 @@ sendmessage(struct natstr *to, char *message, int verbose)
 
     if (to) {
        /* flash */
-       if (player->god || getrel(to, player->cnum) == ALLIED) {
+       if (player->god || to->nat_cnum == player->cnum
+           || getrel(to, player->cnum) == ALLIED) {
            /* Can see TO logged in anyway, so it's okay to tell */
            if (rejected)
                pr("%s is not accepting flashes\n", to->nat_cnam);