]> git.pond.sub.org Git - empserver/commitdiff
Clean up rules on where you can scrap stuff
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 13 Sep 2008 19:27:42 +0000 (15:27 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 15 Sep 2008 11:49:24 +0000 (07:49 -0400)
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.

info/scrap.t
src/lib/commands/scra.c

index da8a2f95505e44b650dee5a07f2e6506c9263a43..a73d31a3423a2247a4e6dce9749585081f9b06ac 100644 (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
index ccf4ecfa7a13b0b97337e851c84463104fc37cd3..e3ce6be3d5c5f69178afce6ea6fdb0dd055790b6 100644 (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)
+           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_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 (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];