therefore had unreachable code. Which was also buggy. Simplify.
{
struct sctstr sect;
struct shpstr ship;
{
struct sctstr sect;
struct shpstr ship;
- struct lndstr land;
- int defvec[I_MAX + 1];
- int shipvec[I_MAX + 1];
int troops;
int n, lunchbox = 0;
int troops;
int n, lunchbox = 0;
move_in_land(combat_mode, off, olist, def);
move_in_land(combat_mode, off, olist, def);
def->mil += troops;
put_combat(off + n);
if (combat_mode == A_ASSAULT) {
def->mil += troops;
put_combat(off + n);
if (combat_mode == A_ASSAULT) {
+ if (off[n].type != EF_SHIP || def->type != EF_SECTOR) {
+ logerror("att_move_in_off: strange assault");
+ continue;
+ }
getship(off[n].shp_uid, &ship);
getship(off[n].shp_uid, &ship);
- getvec(VT_ITEM, shipvec, (s_char *)&ship, EF_SHIP);
- lunchbox += (int)((troops + 1) * shipvec[I_FOOD] /
- (shipvec[I_MILIT] + troops +
- shipvec[I_CIVIL] + 0.5));
- shipvec[I_FOOD] -= lunchbox;
- putvec(VT_ITEM, shipvec, (s_char *)&ship, EF_SHIP);
+ lunchbox += (int)((troops + 1) * ship.shp_item[I_FOOD]
+ / (ship.shp_item[I_MILIT] + troops
+ + ship.shp_item[I_CIVIL] + 0.5));
+ ship.shp_item[I_FOOD] -= lunchbox;
putship(ship.shp_uid, &ship);
}
}
put_combat(def);
if (!lunchbox)
return;
putship(ship.shp_uid, &ship);
}
}
put_combat(def);
if (!lunchbox)
return;
-
- if (def->type == EF_SECTOR) {
- getsect(def->x, def->y, §);
- thing = (s_char *)§
- } else if (def->type == EF_SHIP) {
- getship(def->shp_uid, &ship);
- thing = (s_char *)&ship;
- } else if (def->type == EF_LAND) {
- getship(def->lnd_uid, &land);
- thing = (s_char *)&land;
- } else {
+ if (def->type != EF_SECTOR) {
pr("Please tell the deity that you got the 'hungry mole' error\n");
pr("Please tell the deity that you got the 'hungry mole' error\n");
+ logerror("att_move_in_off: hungry mole");
- getvec(VT_ITEM, defvec, thing, def->type);
- defvec[I_FOOD] += lunchbox;
- putvec(VT_ITEM, defvec, thing, def->type);
- if (def->type == EF_SECTOR)
- putsect(§);
- else if (def->type == EF_SHIP)
- putship(ship.shp_uid, &ship);
- else
- putland(land.lnd_uid, &land);
+ getsect(def->x, def->y, §);
+ sect.sct_item[I_FOOD] += lunchbox;
+ putsect(§);