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.
This commit is contained in:
Markus Armbruster 2011-02-06 10:29:14 +01:00
parent 6852ec6bc5
commit 67b9135e96

View file

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