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.
if (getplayer(cn)
&& (player->god
|| natp->nat_stat == STAT_GOD
if (getplayer(cn)
&& (player->god
|| natp->nat_stat == STAT_GOD
- || cn == player->cnum || getrel(natp, player->cnum) == ALLIED))
+ || relations_with(cn, player->cnum) == ALLIED))
pr(" Now logged on ");
else if (player->god) {
if (natp->nat_last_login == 0)
pr(" Now logged on ");
else if (player->god) {
if (natp->nat_last_login == 0)
}
} else {
/* Ok, we are a normal country, can we flash them? */
}
} else {
/* Ok, we are a normal country, can we flash them? */
- if (to->nat_stat != STAT_GOD && tocn != player->cnum
- && getrel(to, player->cnum) < FRIENDLY) {
+ if (to->nat_stat != STAT_GOD
+ && relations_with(tocn, player->cnum) < FRIENDLY) {
pr("%s is not a deity or friendly with us.\n", to->nat_cnam);
return RET_SYN;
}
pr("%s is not a deity or friendly with us.\n", to->nat_cnam);
return RET_SYN;
}
- if (player->god || to->nat_cnum == player->cnum
- || getrel(to, player->cnum) == ALLIED) {
+ if (player->god
+ || relations_with(to->nat_cnum, player->cnum) == ALLIED) {
/* Can see TO logged in anyway, so it's okay to tell */
if (rejected)
pr("%s is not accepting flashes\n", to->nat_cnam);
/* Can see TO logged in anyway, so it's okay to tell */
if (rejected)
pr("%s is not accepting flashes\n", to->nat_cnam);
cnum = natarg(p, NULL);
if (!(np = getnatp(cnum)))
return RET_SYN;
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;
}
pr("Country %s is not allied with you!\n", np->nat_cnam);
return RET_FAIL;
}