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.
This commit is contained in:
Ron Koenderink 2009-01-07 07:57:37 -06:00
parent afdd0b00c8
commit d0f3847d1d
2 changed files with 9 additions and 5 deletions

View file

@ -89,10 +89,12 @@ xdist and ydist selectors:
.s1 .s1
This finds all sectors that have themselves as a distribution point. This finds all sectors that have themselves as a distribution point.
.s1 .s1
.L "Distributing civilians" .L "Distributing civilians and military"
.s1 .s1
When distributing civilians, no distribution point will ship out its When distributing civilians or military,
last civilian, regardless of thresholds set in sectors using it as a 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. distribution point.
.s1 .s1
.SA "deliver, threshold, level, Distribution" .SA "deliver, threshold, level, Distribution"

View file

@ -118,8 +118,10 @@ dodistribute(struct sctstr *sp, int imex, char *path, double dist_i_cost,
if (dist->sct_mobil <= 0) if (dist->sct_mobil <= 0)
continue; continue;
amt = diff; amt = diff;
if (item == I_CIVIL) /* make sure not to abandon the sector */
amt_dist--; /* Don't send your last civ */ if (item == I_CIVIL ||
(item == I_MILIT && dist->sct_item[I_CIVIL] == 0))
amt_dist--;
if (amt_dist < amt) { if (amt_dist < amt) {
amt = amt_dist; amt = amt_dist;