From 3d3d272eefd848e76e80d085d76c3d66ccafe6e7 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 30 Jun 2012 21:21:49 +0200 Subject: [PATCH] Don't let scrap give away civilians Scrapping unloads everything. Even stuff that unload can't: foreign civilians. Kill them off instead, like scuttle does. --- include/prototypes.h | 1 + src/lib/commands/load.c | 2 +- src/lib/commands/scra.c | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/prototypes.h b/include/prototypes.h index e7be088e..7601a3ee 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -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 *); diff --git a/src/lib/commands/load.c b/src/lib/commands/load.c index fe461557..8ff1866b 100644 --- a/src/lib/commands/load.c +++ b/src/lib/commands/load.c @@ -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) { diff --git a/src/lib/commands/scra.c b/src/lib/commands/scra.c index 9057ad70..98b71ee4 100644 --- a/src/lib/commands/scra.c +++ b/src/lib/commands/scra.c @@ -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(§, 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(§, 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;