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));
|
xyas(sect.sct_x, sect.sct_y, player->cnum));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!player->owner && load_unload == UNLOAD
|
if (load_unload == UNLOAD
|
||||||
|
&& !player->owner
|
||||||
&& getrel(getnatp(sect.sct_own), player->cnum) < FRIENDLY) {
|
&& getrel(getnatp(sect.sct_own), player->cnum) < FRIENDLY) {
|
||||||
if (noisy)
|
if (noisy)
|
||||||
pr("You can't unload into an unfriendly %s\n",
|
pr("You can't unload into an unfriendly %s\n",
|
||||||
|
|
|
@ -100,8 +100,8 @@ lupgr(void)
|
||||||
continue;
|
continue;
|
||||||
if (sect.sct_type != SCT_HEADQ || sect.sct_effic < 60)
|
if (sect.sct_type != SCT_HEADQ || sect.sct_effic < 60)
|
||||||
continue;
|
continue;
|
||||||
if (getrel(getnatp(land.lnd_own), sect.sct_own) < FRIENDLY
|
if (land.lnd_own != sect.sct_own
|
||||||
&& sect.sct_own != land.lnd_own) {
|
&& getrel(getnatp(land.lnd_own), sect.sct_own) < FRIENDLY) {
|
||||||
pr("You are not on friendly terms with the owner of unit %d!\n",
|
pr("You are not on friendly terms with the owner of unit %d!\n",
|
||||||
land.lnd_uid);
|
land.lnd_uid);
|
||||||
continue;
|
continue;
|
||||||
|
@ -181,8 +181,8 @@ supgr(void)
|
||||||
continue;
|
continue;
|
||||||
if (sect.sct_type != SCT_HARBR || sect.sct_effic < 60)
|
if (sect.sct_type != SCT_HARBR || sect.sct_effic < 60)
|
||||||
continue;
|
continue;
|
||||||
if (getrel(getnatp(ship.shp_own), sect.sct_own) < FRIENDLY
|
if (ship.shp_own != sect.sct_own
|
||||||
&& sect.sct_own != ship.shp_own) {
|
&& getrel(getnatp(ship.shp_own), sect.sct_own) < FRIENDLY) {
|
||||||
pr("You are not on friendly terms with the owner of ship %d!\n",
|
pr("You are not on friendly terms with the owner of ship %d!\n",
|
||||||
ship.shp_uid);
|
ship.shp_uid);
|
||||||
continue;
|
continue;
|
||||||
|
@ -261,8 +261,8 @@ pupgr(void)
|
||||||
continue;
|
continue;
|
||||||
if (sect.sct_type != SCT_AIRPT || sect.sct_effic < 60)
|
if (sect.sct_type != SCT_AIRPT || sect.sct_effic < 60)
|
||||||
continue;
|
continue;
|
||||||
if (getrel(getnatp(plane.pln_own), sect.sct_own) < FRIENDLY
|
if (plane.pln_own != sect.sct_own
|
||||||
&& sect.sct_own != plane.pln_own) {
|
&& getrel(getnatp(plane.pln_own), sect.sct_own) < FRIENDLY) {
|
||||||
pr("You are not on friendly terms with the owner of plane %d!\n",
|
pr("You are not on friendly terms with the owner of plane %d!\n",
|
||||||
plane.pln_uid);
|
plane.pln_uid);
|
||||||
continue;
|
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);
|
lnd_stays(actor, "has no mil on it to guide it", llp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (sect.sct_own != land.lnd_own &&
|
if (sect.sct_own != actor &&
|
||||||
getrel(getnatp(sect.sct_own), actor) != ALLIED &&
|
getrel(getnatp(sect.sct_own), actor) != ALLIED &&
|
||||||
!(lchr[(int)llp->unit.land.lnd_type].l_flags & L_SPY) &&
|
!(lchr[(int)llp->unit.land.lnd_type].l_flags & L_SPY) &&
|
||||||
sect.sct_own) {
|
sect.sct_own) {
|
||||||
|
@ -782,9 +782,8 @@ lnd_fort_interdiction(struct emp_qelem *list,
|
||||||
while (nxtsct(&ns, &fsect)) {
|
while (nxtsct(&ns, &fsect)) {
|
||||||
if (fsect.sct_own == 0)
|
if (fsect.sct_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (fsect.sct_own == victim)
|
if (fsect.sct_own == victim
|
||||||
continue;
|
|| getrel(getnatp(fsect.sct_own), victim) >= NEUTRAL)
|
||||||
if (getrel(getnatp(fsect.sct_own), victim) >= NEUTRAL)
|
|
||||||
continue;
|
continue;
|
||||||
range = roundrange(fortrange(&fsect));
|
range = roundrange(fortrange(&fsect));
|
||||||
trange = mapdist(newx, newy, fsect.sct_x, fsect.sct_y);
|
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, §);
|
getsect(newx, newy, §);
|
||||||
navigate = shp_check_nav(§, &mlp->unit.ship);
|
navigate = shp_check_nav(§, &mlp->unit.ship);
|
||||||
if (navigate != CN_NAVIGABLE ||
|
if (navigate != CN_NAVIGABLE ||
|
||||||
(sect.sct_own && actor != sect.sct_own &&
|
(sect.sct_own
|
||||||
getrel(getnatp(sect.sct_own), actor) < FRIENDLY)) {
|
&& sect.sct_own != actor
|
||||||
|
&& getrel(getnatp(sect.sct_own), actor) < FRIENDLY)) {
|
||||||
if (dchr[sect.sct_type].d_nav == NAV_CANAL &&
|
if (dchr[sect.sct_type].d_nav == NAV_CANAL &&
|
||||||
!(((struct mchrstr *)mlp->chrp)->m_flags & M_CANAL) &&
|
!(((struct mchrstr *)mlp->chrp)->m_flags & M_CANAL) &&
|
||||||
navigate == CN_LANDLOCKED)
|
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];
|
mp = &mchr[(int)ship->shp_type];
|
||||||
sp = getsectp(ship->shp_x, ship->shp_y);
|
sp = getsectp(ship->shp_x, ship->shp_y);
|
||||||
|
|
||||||
if ((sp->sct_own != ship->shp_own) && (sp->sct_own != 0)) {
|
if (sp->sct_own != 0
|
||||||
if (getrel(getnatp(sp->sct_own), ship->shp_own) < FRIENDLY)
|
&& sp->sct_own != ship->shp_own
|
||||||
return;
|
&& getrel(getnatp(sp->sct_own), ship->shp_own) < FRIENDLY)
|
||||||
}
|
return;
|
||||||
|
|
||||||
/* only military can work on a military boat */
|
/* only military can work on a military boat */
|
||||||
if (mp->m_glim != 0)
|
if (mp->m_glim != 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue