From: Markus Armbruster Date: Sun, 6 Feb 2011 09:29:14 +0000 (+0100) Subject: Use relations_with() in sendmessage() X-Git-Tag: v4.3.27~124 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=67b9135e96fba21d29c26d1be4b9a3eca80f0d9f Use relations_with() in sendmessage() 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. --- diff --git a/src/lib/commands/flash.c b/src/lib/commands/flash.c index 87c244a89..ffd0fb8d5 100644 --- a/src/lib/commands/flash.c +++ b/src/lib/commands/flash.c @@ -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)) {