]> git.pond.sub.org Git - empserver/commitdiff
Don't let scrap give away civilians
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 30 Jun 2012 19:21:49 +0000 (21:21 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 13 Jul 2012 18:15:33 +0000 (20:15 +0200)
Scrapping unloads everything.  Even stuff that unload can't: foreign
civilians.  Kill them off instead, like scuttle does.

include/prototypes.h
src/lib/commands/load.c
src/lib/commands/scra.c

index e7be088e5d2a5d801a0bf4642de287872cc889e3..7601a3eeefb52b20bf63346e7684d812de283a00 100644 (file)
@@ -54,6 +54,7 @@ extern void finish_server(void);
  * src/lib/commands/ *.c
  */
 extern int check_market(void);
+extern int load_comm_ok(struct sctstr *, natid, i_type, int);
 extern void gift(natid, natid, void *, char *);
 extern int display_mark(i_type, int);
 extern int want_to_abandon(struct sctstr *, i_type, int, struct lndstr *);
index fe4615570eb01856aff1d092c24b99845e0a9272..8ff1866b63427352f052a95f3e25ceda825f05f9 100644 (file)
@@ -337,7 +337,7 @@ move_amount(int sect_amt, int unit_amt, int unit_max,
     return move_amt;
 }
 
-static int
+int
 load_comm_ok(struct sctstr *sectp, natid unit_own,
             i_type item, int move_amt)
 {
index 9057ad70910b69b9a697eedf52fcd6225e7370e2..98b71ee4190498fd3202f87e41cf61362eca5ae0 100644 (file)
@@ -142,7 +142,9 @@ scra(void)
            eff = item.ship.shp_effic / 100.0;
            mp = &mchr[(int)item.ship.shp_type];
            for (i = I_NONE + 1; i <= I_MAX; i++) {
-               sect.sct_item[i] += item.ship.shp_item[i];
+               if (load_comm_ok(&sect, item.ship.shp_own, i,
+                                -item.ship.shp_item[i]))
+                   sect.sct_item[i] += item.ship.shp_item[i];
            }
            sect.sct_item[I_LCM] += mp->m_lcm * 2 / 3 * eff;
            sect.sct_item[I_HCM] += mp->m_hcm * 2 / 3 * eff;
@@ -150,7 +152,9 @@ scra(void)
            eff = item.land.lnd_effic / 100.0;
            lp = &lchr[(int)item.land.lnd_type];
            for (i = I_NONE + 1; i <= I_MAX; i++) {
-               sect.sct_item[i] += item.land.lnd_item[i];
+               if (load_comm_ok(&sect, item.land.lnd_own, i,
+                                -item.land.lnd_item[i]))
+                   sect.sct_item[i] += item.land.lnd_item[i];
            }
            sect.sct_item[I_LCM] += lp->l_lcm * 2 / 3 * eff;
            sect.sct_item[I_HCM] += lp->l_hcm * 2 / 3 * eff;