Optimize sendmessage() use of getnatp()

Don't call it when its value must be TO anyway.

While there, oops when it fails instead of recovering silently.
This commit is contained in:
Markus Armbruster 2011-02-05 11:17:40 +01:00
parent fc633a4f1f
commit e21f5035cb

View file

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