/*
* 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
case A_BOARD:
if (off->type == EF_SECTOR && off->mob <= 0)
return 0;
- mob_support = vl_find(V_MILIT, def->shp_mcp->m_vtype,
- def->shp_mcp->m_vamt, def->shp_mcp->m_nv);
+ mob_support = def->shp_mcp->m_item[I_MILIT];
if (mob_support < off->troops)
pr("The size of the ship you are trying to board limits your party to %d mil,\n", mob_support);
else
return 0;
if (def->lnd_lcp->l_flags & L_SPY)
return 1;
- mob_support = vl_find(V_MILIT, def->lnd_lcp->l_vtype,
- def->lnd_lcp->l_vamt, def->lnd_lcp->l_nv);
+ mob_support = def->lnd_lcp->l_item[I_MILIT];
if (mob_support < off->troops)
pr("The size of the unit you are trying to board limits your party to %d mil,\n", mob_support);
else
struct sctstr sect;
struct shpstr ship;
int troops;
- int n, lunchbox = 0;
+ int n, lunchbox;
move_in_land(combat_mode, off, olist, def);
+ getsect(def->x, def->y, §);
+
for (n = 0; n <= off->last; ++n) {
if (off[n].type == EF_BAD || !off[n].troops)
continue;
continue;
}
getship(off[n].shp_uid, &ship);
- lunchbox += (int)((troops + 1) * ship.shp_item[I_FOOD]
- / (ship.shp_item[I_MILIT] + troops
- + ship.shp_item[I_CIVIL] + 0.5));
+ lunchbox = (int)((troops + 1) * ship.shp_item[I_FOOD]
+ / (ship.shp_item[I_MILIT] + troops
+ + ship.shp_item[I_CIVIL] + 0.5));
+ if (lunchbox > ITEM_MAX - sect.sct_item[I_FOOD])
+ lunchbox = ITEM_MAX - sect.sct_item[I_FOOD];
+
ship.shp_item[I_FOOD] -= lunchbox;
+ sect.sct_item[I_FOOD] += lunchbox;
putship(ship.shp_uid, &ship);
}
}
- put_combat(def);
- if (!lunchbox)
- return;
- if (def->type != EF_SECTOR) {
- pr("Please tell the deity that you got the 'hungry mole' error\n");
- logerror("att_move_in_off: hungry mole");
- return;
- }
- getsect(def->x, def->y, §);
- sect.sct_item[I_FOOD] += lunchbox;
+
putsect(§);
+ put_combat(def);
}
}
if (dam) {
- left = commdamage(num_mil, dam, V_MILIT);
+ left = commdamage(num_mil, dam, I_MILIT);
if (left < num_mil) {
if (left) {
pr("%d of the mil you were moving were destroyed!\nOnly %d mil made it to %s\n", num_mil - left, left, xyas(def->x, def->y, player->cnum));