Use relations_with() for US==THEM || getrel(getnatp(US), THEM)
Replacing getrel(getnatp(US), THEM) by relations_with(US, THEM) makes a difference only when US equals THEM. Replace patterns like "us == them || getrel(getnatp(us), them)..." by "relations_with(us, them)...".
This commit is contained in:
parent
ef7b9cedc3
commit
8e75b22e0d
Notes:
Markus Armbruster
2013-01-26 12:01:24 +01:00
Author: Markus Armbruster <armbru@pond.sub.org> Same guy, wrong e-mail address.
13 changed files with 25 additions and 46 deletions
|
@ -74,8 +74,7 @@ drop(void)
|
|||
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");
|
||||
|
|
|
@ -60,8 +60,7 @@ foll(void)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -165,8 +165,7 @@ scuttle_tradeship(struct shpstr *sp, int interactive)
|
|||
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 */
|
||||
|
|
|
@ -47,7 +47,7 @@ shar(void)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -100,8 +100,7 @@ lupgr(void)
|
|||
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;
|
||||
|
@ -181,8 +180,7 @@ supgr(void)
|
|||
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;
|
||||
|
@ -261,8 +259,7 @@ pupgr(void)
|
|||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue