* Dave Pare, 1986
* Thomas Ruschak, 1993 (rewritten)
* Steve McClure, 1998
+ * Markus Armbruster, 2008-2011
*/
#include <config.h>
struct sctstr sect, dsect, tsect;
struct nstr_sect nstr;
char *p;
- double move_cost = 0.0;
+ double move_cost;
coord dstx, dsty;
char buf[1024];
pr("Warning: you don't own %s!\n",
xyas(dsect.sct_x, dsect.sct_y, player->cnum));
- if (!BestDistPath(buf, §, &dsect, &move_cost)) {
+ move_cost = path_find(sect.sct_x, sect.sct_y, dstx, dsty,
+ player->cnum, MOB_MOVE);
+ if (move_cost < 0) {
pr("No owned path from %s to %s.\n",
xyas(dsect.sct_x, dsect.sct_y, player->cnum),
xyas(sect.sct_x, sect.sct_y, player->cnum));
* Known contributors to this file:
* Ken Stevens, 1995
* Steve McClure, 1996-2000
- * Markus Armbruster, 2006-2009
+ * Markus Armbruster, 2006-2011
*/
#include <config.h>
{
struct nstr_item ni;
struct lndstr land;
- struct sctstr sect, dsect;
struct ulist *llp;
int dtotal;
double new_land = 0;
double pathcost;
int origx, origy;
double eff = att_combat_eff(def);
- char buf[1024];
if (list)
dtotal = get_dtotal(def, list, 1.0, 1);
if (!in_oparea((struct empobj *)&land, def->x, def->y))
continue;
- getsect(land.lnd_x, land.lnd_y, §);
- getsect(def->x, def->y, &dsect);
- if (!BestLandPath(buf, §, &dsect, &pathcost,
- lnd_mobtype(&land)))
+ pathcost = path_find(land.lnd_x, land.lnd_y, def->x, def->y,
+ def->own, lnd_mobtype(&land));
+ if (pathcost < 0)
continue;
-
mobcost = lnd_pathcost(&land, pathcost);
if (land.lnd_mobil < mobcost)
continue;
* supply.c: Supply subroutines
*
* Known contributors to this file:
- * Markus Armbruster, 2004-2009
+ * Markus Armbruster, 2004-2011
*/
#include <config.h>
coord x = sink->x;
coord y = sink->y;
int lookrange;
- struct sctstr sect, dest;
+ struct sctstr sect;
struct nstr_sect ns;
struct nstr_item ni;
struct lchrstr *lcp;
int packing;
struct dchrstr *dp;
struct ichrstr *ip;
- char buf[1024];
if (wanted > limit)
wanted = limit;
return 1;
wanted -= vec[type];
- getsect(x, y, &dest);
-
/* try to get it from sector we're in */
if (sink->ef_type != EF_SECTOR) {
getsect(x, y, §);
continue;
if (sect.sct_effic < 60)
continue;
- if (!BestLandPath(buf, §, &dest, &move_cost, MOB_MOVE))
+ move_cost = path_find(sect.sct_x, sect.sct_y, x, y, own, MOB_MOVE);
+ if (move_cost < 0)
continue;
if (!opt_NOFOOD && type == I_FOOD)
minimum = 1 + (int)ceil(food_needed(sect.sct_item,
continue;
if (sect.sct_effic < 2)
continue;
- if (!BestLandPath(buf, §, &dest, &move_cost, MOB_MOVE))
+ move_cost = path_find(sect.sct_x, sect.sct_y, x, y, own, MOB_MOVE);
+ if (move_cost < 0)
continue;
if (!opt_NOFOOD && type == I_FOOD)
minimum = 1 + (int)ceil(food_needed(ship.shp_item,
continue;
getsect(land.lnd_x, land.lnd_y, §);
- if (!BestLandPath(buf, §, &dest, &move_cost, MOB_MOVE))
+ move_cost = path_find(land.lnd_x, land.lnd_y, x, y, own, MOB_MOVE);
+ if (move_cost < 0)
continue;
if ((land.lnd_ship >= 0) && (sect.sct_type != SCT_HARBR))