Use relations_with() for US==THEM || getrel(NP, THEM)

Replace patterns like "US == THEM || getrel(NP, THEM)...", where NP is
known to be getnatp(US), by "relations_with(US, THEM)...".  No
functional change.

Adds a few calls 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:06:38 +01:00
parent 928e9a4cc3
commit bdf63bc5fa
3 changed files with 6 additions and 7 deletions

View file

@ -67,8 +67,7 @@ orig(void)
cnum = natarg(p, NULL);
if (!(np = getnatp(cnum)))
return RET_SYN;
if (!player->god && player->cnum != cnum
&& getrel(np, player->cnum) != ALLIED) {
if (!player->god && relations_with(cnum, player->cnum) != ALLIED) {
pr("Country %s is not allied with you!\n", np->nat_cnam);
return RET_FAIL;
}