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

@ -1,23 +1,18 @@
.TH Command SCRAP
.NA scrap "Scrap a ship, plane, or unit"
.NA scrap "Scrap a ship, plane, or land unit"
.LV Basic
.SY "scrap <s|l|p> <SHIPS | UNITS | PLANES>"
This command allows you to scrap planes/units/ships when you no longer
need them.
.s1
Ships may only be scrapped friendly 60% harbours.
Planes may only be scrapped in 60% airfields.
Units may be scrapped in any sector.
Ships may only be scrapped in own or friendly 60% harbours.
Planes may only be scrapped in own or allied 60% airfields.
Land units may only be scrapped in own or allied sectors.
.s1
When scrapping a unit, plane or ship, you receive materials equal to 2/3
the amount used to build it. The materials are put in the sector where
the scrapping occurs.
.s1
When scrapping a unit, you also get the military that the unit represents
as mil in the sector. (Example: a unit that takes 100 mil to build is
at 50%, and is scrapped. 50 mil will be added to the sector) Units on
ships cannot be scrapped.
.s1
If you scrap a ship or unit that has planes on board, the planes will
be transferred to the sector.
.s1

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)
continue;
if (sect.sct_effic < 60 ||
(sect.sct_own != player->cnum &&
getrel(getnatp(sect.sct_own), player->cnum) < FRIENDLY))
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 (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];