Rearrange uses of getrel() slightly
Just to make the next few commits easier to review.
This commit is contained in:
parent
7ebbe7da4c
commit
ef7b9cedc3
5 changed files with 18 additions and 17 deletions
|
@ -143,7 +143,8 @@ load(void)
|
|||
xyas(sect.sct_x, sect.sct_y, player->cnum));
|
||||
continue;
|
||||
}
|
||||
if (!player->owner && load_unload == UNLOAD
|
||||
if (load_unload == UNLOAD
|
||||
&& !player->owner
|
||||
&& getrel(getnatp(sect.sct_own), player->cnum) < FRIENDLY) {
|
||||
if (noisy)
|
||||
pr("You can't unload into an unfriendly %s\n",
|
||||
|
|
|
@ -100,8 +100,8 @@ lupgr(void)
|
|||
continue;
|
||||
if (sect.sct_type != SCT_HEADQ || sect.sct_effic < 60)
|
||||
continue;
|
||||
if (getrel(getnatp(land.lnd_own), sect.sct_own) < FRIENDLY
|
||||
&& sect.sct_own != land.lnd_own) {
|
||||
if (land.lnd_own != sect.sct_own
|
||||
&& getrel(getnatp(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;
|
||||
|
@ -181,8 +181,8 @@ supgr(void)
|
|||
continue;
|
||||
if (sect.sct_type != SCT_HARBR || sect.sct_effic < 60)
|
||||
continue;
|
||||
if (getrel(getnatp(ship.shp_own), sect.sct_own) < FRIENDLY
|
||||
&& sect.sct_own != ship.shp_own) {
|
||||
if (ship.shp_own != sect.sct_own
|
||||
&& getrel(getnatp(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;
|
||||
|
@ -261,8 +261,8 @@ pupgr(void)
|
|||
continue;
|
||||
if (sect.sct_type != SCT_AIRPT || sect.sct_effic < 60)
|
||||
continue;
|
||||
if (getrel(getnatp(plane.pln_own), sect.sct_own) < FRIENDLY
|
||||
&& sect.sct_own != plane.pln_own) {
|
||||
if (plane.pln_own != sect.sct_own
|
||||
&& getrel(getnatp(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;
|
||||
|
|
|
@ -501,7 +501,7 @@ lnd_mar(struct emp_qelem *list, double *minmobp, double *maxmobp,
|
|||
lnd_stays(actor, "has no mil on it to guide it", llp);
|
||||
continue;
|
||||
}
|
||||
if (sect.sct_own != land.lnd_own &&
|
||||
if (sect.sct_own != actor &&
|
||||
getrel(getnatp(sect.sct_own), actor) != ALLIED &&
|
||||
!(lchr[(int)llp->unit.land.lnd_type].l_flags & L_SPY) &&
|
||||
sect.sct_own) {
|
||||
|
@ -782,9 +782,8 @@ lnd_fort_interdiction(struct emp_qelem *list,
|
|||
while (nxtsct(&ns, &fsect)) {
|
||||
if (fsect.sct_own == 0)
|
||||
continue;
|
||||
if (fsect.sct_own == victim)
|
||||
continue;
|
||||
if (getrel(getnatp(fsect.sct_own), victim) >= NEUTRAL)
|
||||
if (fsect.sct_own == victim
|
||||
|| getrel(getnatp(fsect.sct_own), victim) >= NEUTRAL)
|
||||
continue;
|
||||
range = roundrange(fortrange(&fsect));
|
||||
trange = mapdist(newx, newy, fsect.sct_x, fsect.sct_y);
|
||||
|
|
|
@ -749,8 +749,9 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
|
|||
getsect(newx, newy, §);
|
||||
navigate = shp_check_nav(§, &mlp->unit.ship);
|
||||
if (navigate != CN_NAVIGABLE ||
|
||||
(sect.sct_own && actor != sect.sct_own &&
|
||||
getrel(getnatp(sect.sct_own), actor) < FRIENDLY)) {
|
||||
(sect.sct_own
|
||||
&& sect.sct_own != actor
|
||||
&& getrel(getnatp(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)
|
||||
|
|
|
@ -267,10 +267,10 @@ shiprepair(struct shpstr *ship, struct natstr *np, struct bp *bp, int etus)
|
|||
mp = &mchr[(int)ship->shp_type];
|
||||
sp = getsectp(ship->shp_x, ship->shp_y);
|
||||
|
||||
if ((sp->sct_own != ship->shp_own) && (sp->sct_own != 0)) {
|
||||
if (getrel(getnatp(sp->sct_own), ship->shp_own) < FRIENDLY)
|
||||
if (sp->sct_own != 0
|
||||
&& sp->sct_own != ship->shp_own
|
||||
&& getrel(getnatp(sp->sct_own), ship->shp_own) < FRIENDLY)
|
||||
return;
|
||||
}
|
||||
|
||||
/* only military can work on a military boat */
|
||||
if (mp->m_glim != 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue