/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
int left;
int mcost, dam;
int infected;
- int stype;
int vtype;
int amt_src;
int amt_dst;
- struct dchrstr *dp;
struct ichrstr *ip;
int work;
int loyal;
* goodies in occupied territory.
*/
if (!istest && sect.sct_oldown != player->cnum && vtype != I_MILIT) {
- int tot_mil = 0;
- struct nstr_item ni;
- struct lndstr land;
- snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
- while (nxtitem(&ni, (s_char *)&land)) {
- if (land.lnd_own == player->cnum)
- tot_mil += total_mil(&land);
- }
- if ((sect.sct_item[I_MILIT] + tot_mil) * 10 < sect.sct_item[I_CIVIL]) {
+ if (!military_control(§)) {
pr("Military control required to move goods.\n");
return RET_FAIL;
}
}
- stype = sect.sct_type;
- dp = &dchr[stype];
infected = sect.sct_pstage == PLG_INFECT;
amt_src = sect.sct_item[vtype];
if (!istest && amt_src <= 0) {
xyas(sect.sct_x, sect.sct_y, player->cnum));
return RET_SYN;
}
- if (vtype == I_CIVIL) {
- work = sect.sct_work;
- if (work != 100)
- pr("Warning: civil unrest\n");
- loyal = sect.sct_loyal;
- } else if (vtype == I_MILIT) {
- work = 100;
- loyal = 0;
- }
+
+ /* only used when moving civs; but prevent spurious compiler warnings */
+ work = sect.sct_work;
+ loyal = sect.sct_loyal;
+ if (vtype == I_CIVIL && work != 100)
+ pr("Warning: civil unrest\n");
+
if (istest)
sprintf(prompt, "Number of %s to test move? ", ip->i_name);
else
if (amount <= 0)
return RET_SYN;
- packing = ip->i_pkg[dp->d_pkg];
- if (packing > 1 && sect.sct_effic < 60)
- packing = 1;
- weight = (double)amount *ip->i_lbs / packing;
+ packing = sect.sct_effic >= 60 ? dchr[sect.sct_type].d_pkg : IPKG;
+ weight = (double)amount * ip->i_lbs / ip->i_pkg[packing];
/*
* First remove commodities from source sector
*/