From d0f3847d1dc7620d7fce0ba4fc2058c179a9e178 Mon Sep 17 00:00:00 2001 From: Ron Koenderink Date: Wed, 7 Jan 2009 07:57:37 -0600 Subject: [PATCH] Prevent distribution from abandoning the distribution center If there are no civilians in the distribution center, distribution could abandon the sector by distributing out all the military. --- info/distribute.t | 8 +++++--- src/lib/update/distribute.c | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/info/distribute.t b/info/distribute.t index 9d6af56c8..6f59b30b3 100644 --- a/info/distribute.t +++ b/info/distribute.t @@ -89,10 +89,12 @@ xdist and ydist selectors: .s1 This finds all sectors that have themselves as a distribution point. .s1 -.L "Distributing civilians" +.L "Distributing civilians and military" .s1 -When distributing civilians, no distribution point will ship out its -last civilian, regardless of thresholds set in sectors using it as a +When distributing civilians or military, +no distribution point will ship out its last civilian or +the last military if there are no civilians, +regardless of thresholds set in sectors using it as a distribution point. .s1 .SA "deliver, threshold, level, Distribution" diff --git a/src/lib/update/distribute.c b/src/lib/update/distribute.c index 91ae6b725..9ef38ebbf 100644 --- a/src/lib/update/distribute.c +++ b/src/lib/update/distribute.c @@ -118,8 +118,10 @@ dodistribute(struct sctstr *sp, int imex, char *path, double dist_i_cost, if (dist->sct_mobil <= 0) continue; amt = diff; - if (item == I_CIVIL) - amt_dist--; /* Don't send your last civ */ + /* make sure not to abandon the sector */ + if (item == I_CIVIL || + (item == I_MILIT && dist->sct_item[I_CIVIL] == 0)) + amt_dist--; if (amt_dist < amt) { amt = amt_dist; -- 2.43.0