]> git.pond.sub.org Git - empserver/commitdiff
Use relations_with() in sendmessage()
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Feb 2011 09:29:14 +0000 (10:29 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 18 Feb 2011 17:46:05 +0000 (18:46 +0100)
We know player != other.  Because we can have only one player in state
PS_PLAYING per country, and we know other->state == PS_PLAYING, it
follows that player->cnum != other->cnum.  Thus, no functional change.

Adds another call to getnatp() hidden in relations_with(), though.
Keeping that optimized isn't worth it.

src/lib/commands/flash.c

index 87c244a89ee4df26b2857fd76631629a23996818..ffd0fb8d56f6bfcb1504c2b0c21f257d225da400 100644 (file)
@@ -140,7 +140,8 @@ sendmessage(struct natstr *to, char *message, int verbose)
            wto = getnatp(other->cnum);
            if (CANT_HAPPEN(!wto))
                continue;
-           if (!player->god && getrel(wto, player->cnum) != ALLIED)
+           if (!player->god
+               && relations_with(other->cnum, player->cnum) != ALLIED)
                continue;
        }
        if (!player->god && !(wto->nat_flags & NF_FLASH)) {