return RET_SYN;
getsect(tx, ty, &target);
- if (target.sct_own == player->cnum
- || getrel(getnatp(target.sct_own), player->cnum) == ALLIED) {
+ if (relations_with(target.sct_own, player->cnum) == ALLIED) {
/* own or allied sector: cargo drop */
if (ip->i_uid == I_CIVIL && target.sct_own != target.sct_oldown) {
pr("Can't drop civilians into occupied sectors.\n");
if (!good)
return RET_SYN;
getship(leader, &ship);
- if (ship.shp_own != player->cnum &&
- getrel(getnatp(ship.shp_own), player->cnum) < FRIENDLY) {
+ if (relations_with(ship.shp_own, player->cnum) < FRIENDLY) {
pr("That ship won't let you follow.\n");
return RET_FAIL;
}
mp = &mchr[(int)sp->shp_type];
getsect(sp->shp_x, sp->shp_y, §);
if (sect.sct_own && sect.sct_type == SCT_HARBR && sect.sct_effic >= 2
- && (sect.sct_own == sp->shp_own
- || getrel(getnatp(sect.sct_own), sp->shp_own) >= FRIENDLY)) {
+ && relations_with(sect.sct_own, sp->shp_own) >= FRIENDLY) {
dist = mapdist(sp->shp_x, sp->shp_y,
sp->shp_orig_x, sp->shp_orig_y);
/* Don't disclose distance to to pirates */
if (to < 0)
return RET_SYN;
- if (to != player->cnum && getrel(getnatp(to), player->cnum) < FRIENDLY) {
+ if (relations_with(to, player->cnum) < FRIENDLY) {
pr("%s does not have friendly relations towards you\n", cname(to));
return RET_FAIL;
}
continue;
if (sect.sct_type != SCT_HEADQ || sect.sct_effic < 60)
continue;
- if (land.lnd_own != sect.sct_own
- && getrel(getnatp(land.lnd_own), sect.sct_own) < FRIENDLY) {
+ if (relations_with(land.lnd_own, sect.sct_own) < FRIENDLY) {
pr("You are not on friendly terms with the owner of unit %d!\n",
land.lnd_uid);
continue;
continue;
if (sect.sct_type != SCT_HARBR || sect.sct_effic < 60)
continue;
- if (ship.shp_own != sect.sct_own
- && getrel(getnatp(ship.shp_own), sect.sct_own) < FRIENDLY) {
+ if (relations_with(ship.shp_own, sect.sct_own) < FRIENDLY) {
pr("You are not on friendly terms with the owner of ship %d!\n",
ship.shp_uid);
continue;
continue;
if (sect.sct_type != SCT_AIRPT || sect.sct_effic < 60)
continue;
- if (plane.pln_own != sect.sct_own
- && getrel(getnatp(plane.pln_own), sect.sct_own) < FRIENDLY) {
+ if (relations_with(plane.pln_own, sect.sct_own) < FRIENDLY) {
pr("You are not on friendly terms with the owner of plane %d!\n",
plane.pln_uid);
continue;
while (nxtitem(&ni, &ship)) {
if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
continue;
- if (ship.shp_own != own
- && getrel(getnatp(ship.shp_own), own) != ALLIED)
+ if (relations_with(ship.shp_own, own) != ALLIED)
continue;
if ((carrier_planes(&ship, 0) & (P_L | P_K)) == 0)
continue;
lnd_stays(actor, "has no mil on it to guide it", llp);
continue;
}
- if (sect.sct_own != actor &&
- getrel(getnatp(sect.sct_own), actor) != ALLIED &&
+ if (relations_with(sect.sct_own, actor) != ALLIED &&
!(lchr[(int)llp->unit.land.lnd_type].l_flags & L_SPY) &&
sect.sct_own) {
sprintf(mess, "has been kidnapped by %s", cname(sect.sct_own));
while (nxtsct(&ns, &fsect)) {
if (fsect.sct_own == 0)
continue;
- if (fsect.sct_own == victim
- || getrel(getnatp(fsect.sct_own), victim) >= NEUTRAL)
+ if (relations_with(fsect.sct_own, victim) >= NEUTRAL)
continue;
range = roundrange(fortrange(&fsect));
trange = mapdist(newx, newy, fsect.sct_x, fsect.sct_y);
snxtitem_xy(&ni, EF_LAND, x, y);
while (nxtitem(&ni, &land)) {
- if (land.lnd_own != cn && getrel(getnatp(land.lnd_own), cn) != ALLIED)
+ if (relations_with(land.lnd_own, cn) != ALLIED)
continue;
if (lchr[(int)land.lnd_type].l_flags & L_ENGINEER)
return 1;
return NULL;
/* over own or allied sector is fine */
- if (ap_sect->sct_own == player->cnum
- || getrel(getnatp(ap_sect->sct_own), player->cnum) == ALLIED)
+ if (relations_with(ap_sect->sct_own, player->cnum) == ALLIED)
return ap_sect;
/* over own or allied ship is fine */
while (nxtitem(&ni, &ship)) {
if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
continue;
- if (ship.shp_own == player->cnum
- || getrel(getnatp(ship.shp_own), player->cnum) == ALLIED)
+ if (relations_with(ship.shp_own, player->cnum) == ALLIED)
return ap_sect;
}
}
/* try to land at sector */
- if (target->sct_own != player->cnum
- && getrel(getnatp(target->sct_own), player->cnum) != ALLIED) {
+ if (relations_with(target->sct_own, player->cnum) != ALLIED) {
pr("Nowhere to land at sector %s!\n",
xyas(target->sct_x, target->sct_y, player->cnum));
return -1;
pr("Your %s vanish without a trace.\n", ip->i_name);
return;
}
- if (sect.sct_own != player->cnum
- && getrel(getnatp(sect.sct_own), player->cnum) != ALLIED) {
+ if (relations_with(sect.sct_own, player->cnum) != ALLIED) {
pr("You don't own %s! Cargo jettisoned...\n",
xyas(tx, ty, player->cnum));
return;
CANT_REACH();
return 0;
}
- if (ship.shp_own != pp->pln_own
- && getrel(getnatp(ship.shp_own), pp->pln_own) != ALLIED) {
+ if (relations_with(ship.shp_own, pp->pln_own) != ALLIED) {
if (noisy)
pr("(note) An ally does not own the ship %s is on\n",
prplane(pp));
CANT_REACH();
return 0;
}
- if (land.lnd_own != pp->pln_own
- && getrel(getnatp(land.lnd_own), pp->pln_own) != ALLIED) {
+ if (relations_with(land.lnd_own, pp->pln_own) != ALLIED) {
if (noisy)
pr("(note) An ally does not own the unit %s is on\n",
prplane(pp));
return 0;
}
- if (sect.sct_own != pp->pln_own
- && getrel(getnatp(sect.sct_own), pp->pln_own) != ALLIED) {
+ if (relations_with(sect.sct_own, pp->pln_own) != ALLIED) {
if (noisy)
pr("(note) An ally does not own the sector %s is in\n",
prplane(pp));
getsect(newx, newy, §);
if (shp_check_nav(§, sp) != CN_NAVIGABLE ||
- (sect.sct_own && sect.sct_own != sp->shp_own &&
- getrel(getnatp(sect.sct_own), sp->shp_own) < FRIENDLY)) {
+ (sect.sct_own
+ && relations_with(sect.sct_own, sp->shp_own) < FRIENDLY)) {
wu(0, sp->shp_own, "%s %s,\nbut could not retreat to %s!\n",
prship(sp), conditions[findcondition(code)].desc[orig],
xyas(newx, newy, sp->shp_own));
navigate = shp_check_nav(§, &mlp->unit.ship);
if (navigate != CN_NAVIGABLE ||
(sect.sct_own
- && sect.sct_own != actor
- && getrel(getnatp(sect.sct_own), actor) < FRIENDLY)) {
+ && relations_with(sect.sct_own, actor) < FRIENDLY)) {
if (dchr[sect.sct_type].d_nav == NAV_CANAL &&
!(((struct mchrstr *)mlp->chrp)->m_flags & M_CANAL) &&
navigate == CN_LANDLOCKED)
/* land is ok; no repairs needed */
return;
}
- if ((sp->sct_own != land->lnd_own) &&
- (getrel(getnatp(sp->sct_own), land->lnd_own) != ALLIED))
+ if (relations_with(sp->sct_own, land->lnd_own) != ALLIED)
return;
if (!player->simulation)
return;
if (carrier->shp_off)
return;
- if ((carrier->shp_own != pp->pln_own) &&
- (getrel(getnatp(carrier->shp_own), pp->pln_own) != ALLIED))
+ if (relations_with(carrier->shp_own, pp->pln_own) != ALLIED)
return;
} else {
- if ((sp->sct_own != pp->pln_own) &&
- (getrel(getnatp(sp->sct_own), pp->pln_own) != ALLIED))
+ if (relations_with(sp->sct_own, pp->pln_own) != ALLIED)
return;
}
sp = getsectp(ship->shp_x, ship->shp_y);
if (sp->sct_own != 0
- && sp->sct_own != ship->shp_own
- && getrel(getnatp(sp->sct_own), ship->shp_own) < FRIENDLY)
+ && relations_with(sp->sct_own, ship->shp_own) < FRIENDLY)
return;
/* only military can work on a military boat */