Clean up rules on where you can scrap stuff

You can now scrap ships in own or friendly, efficient harbors, planes
in own or allied, efficient airfields, and land units in any own or
allied sector.

When something can't be scrapped because of these rules, print a
suitable message.

Before, you could scrap ships regardless of relations to sector owner
(info claimed friendly was required), land units regardless of
relations, but not while on ships, and planes even in friendly
airfields (info claimed allied was required).

When scrapping in a deity sector, scrap claimed it gave the cargo to
POGO, which is somewhat bogus, as POGO can't own such stuff.
This commit is contained in:
Markus Armbruster 2008-09-13 15:27:42 -04:00
parent 06dd3d80ac
commit 221324cc10
2 changed files with 25 additions and 24 deletions

View file

@ -134,28 +134,34 @@ scra(void)
}
}
getsect(item.gen.x, item.gen.y, &sect);
if (type == EF_SHIP) {
getsect(item.ship.shp_x, item.ship.shp_y, &sect);
if (sect.sct_type != SCT_HARBR)
continue;
if (sect.sct_effic < 60 || sect.sct_own != player->cnum)
continue;
} else if (type == EF_LAND) {
if (item.land.lnd_ship >= 0) {
pr("%s is on a ship, and cannot be scrapped!\n",
prland(&item.land));
if (!player->owner
&& getrel(getnatp(sect.sct_own), player->cnum) < FRIENDLY) {
pr("%s is not in a friendly harbor!\n",
prship(&item.ship));
continue;
}
if (sect.sct_type != SCT_HARBR || sect.sct_effic < 60) {
pr("%s is not in a 60%% efficient harbor!\n",
prship(&item.ship));
continue;
}
getsect(item.land.lnd_x, item.land.lnd_y, &sect);
} else {
getsect(item.plane.pln_x, item.plane.pln_y, &sect);
if (sect.sct_type != SCT_AIRPT)
if (!player->owner
&& getrel(getnatp(sect.sct_own), player->cnum) != ALLIED) {
pr("%s is not in an allied sector!\n",
obj_nameof(&item.gen));
continue;
if (sect.sct_effic < 60 ||
(sect.sct_own != player->cnum &&
getrel(getnatp(sect.sct_own), player->cnum) < FRIENDLY))
}
if (type == EF_PLANE
&& (sect.sct_type != SCT_AIRPT || sect.sct_effic < 60)) {
pr("%s is not in a 60%% efficient airfield!\n",
prplane(&item.plane));
continue;
}
}
if (type == EF_SHIP) {
eff = item.ship.shp_effic / 100.0;
mp = &mchr[(int)item.ship.shp_type];