/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2014, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
* Known contributors to this file:
* Chad Zabel, 1994
* Steve McClure, 2000
+ * Markus Armbruster, 2004-2013
*/
#include <config.h>
if (!*p || !strcmp(p, "-")) {
pr("A one-way order has been accepted.\n");
} else if (!strncmp(p, "s", 1)) {
- if (opt_TRADESHIPS) {
- if (!(mchr[(int)ship.shp_type].m_flags & M_TRADE)) {
- pr("You can't auto-scuttle that ship!\n");
- return RET_SYN;
- }
- } else {
+ if (!(mchr[(int)ship.shp_type].m_flags & M_TRADE)) {
pr("You can't auto-scuttle that ship!\n");
return RET_SYN;
}
{
int nships = 0;
int len, updates;
- char *c;
+ double c;
struct nstr_item nb;
struct shpstr ship;
- char buf[1024];
if (!snxtitem(&nb, EF_SHIP, player->argp[1], NULL))
return RET_SYN;
if (!nships) { /* 1st ship, print banner */
if (player->god)
pr("own ");
- pr("shp# ship type x,y ");
- pr("start end ");
- pr("len eta\n");
+ pr("shp# ship type x,y start end "
+ " len eta\n");
}
nships++;
if (player->god)
pr("%3d ", ship.shp_own);
pr("%4d", nb.cur);
pr(" %-16.16s", mchr[(int)ship.shp_type].m_name);
- prxy(" %3d,%-3d", ship.shp_x, ship.shp_y);
+ prxy(" %4d,%-4d", ship.shp_x, ship.shp_y);
if (ship.shp_autonav & AN_AUTONAV) {
/* Destination 1 */
- prxy(" %3d,%-3d", ship.shp_destx[1], ship.shp_desty[1]);
+ prxy(" %4d,%-4d", ship.shp_destx[1], ship.shp_desty[1]);
/* Destination 2 */
if ((ship.shp_destx[1] != ship.shp_destx[0])
|| (ship.shp_desty[1] != ship.shp_desty[0])) {
- prxy(" %3d,%-3d", ship.shp_destx[0], ship.shp_desty[0]);
+ prxy(" %4d,%-4d", ship.shp_destx[0], ship.shp_desty[0]);
} else
- pr(" ");
+ pr(" ");
if (ship.shp_autonav & AN_STANDBY)
pr(" suspended");
pr(" loading");
else {
/* ETA calculation */
-
- c = BestShipPath(buf, ship.shp_x, ship.shp_y,
- ship.shp_destx[0], ship.shp_desty[0],
- ship.shp_own);
- if (!c)
+ c = path_find(ship.shp_x, ship.shp_y,
+ ship.shp_destx[0], ship.shp_desty[0],
+ ship.shp_own, MOB_SAIL);
+ if (c < 0)
pr(" no route possible");
- else if (*c == 'h')
+ else if (c == 0)
pr(" has arrived");
else {
/* distance to destination */
- len = strlen(c);
+ len = (int)c;
updates = eta_calc(&ship, len);
pr(" %3d %4d", len, updates);
}