* ---
*
* nav_ship.c: Navigate ships and such
- *
+ *
* Known contributors to this file:
* Chad Zabel, 1994
* Ken Stevens, 1995
sp->shp_x, sp->shp_y, sp->shp_uid);
return;
}
- if (sectp->sct_type != SCT_HARBR || sectp->sct_effic < 2) {
- wu(0, sp->shp_own,
- "%s is not in a harbor at least 2%% eff! Not scuttling.\n",
- prship(sp));
- return;
- }
if (opt_TRADESHIPS) {
if (!(mchr[(int)sp->shp_type].m_flags & M_TRADE)) {
wu(0, sp->shp_own, "You can only autoscuttle trade ships!\n");
return;
}
}
+ if (!scuttle_tradeship(sp, 0)) {
+ wu(0, sp->shp_own,
+ "%s doesn't pay here! Not scuttled.\n", prship(sp));
+ return;
+ }
wu(0, sp->shp_own, "Scuttling %s in sector %s\n",
prship(sp), xyas(sp->shp_x, sp->shp_y, sp->shp_own));
- if (opt_TRADESHIPS) {
- scuttle_tradeship(sp, 0);
- }
- scuttle_ship(sp);
+ if (sectp->sct_own == sp->shp_own)
+ unit_drop_cargo((struct empobj *)sp, sectp->sct_own);
+ sp->shp_effic = 0;
+ putship(sp->shp_uid, sp);
}
static void
sp->shp_autonav &= ~AN_LOADING;
if (!(sectp = getsectp(sp->shp_x, sp->shp_y)))
- return RET_SYS; /* safety */
- /* I suspect RET_SYS isn't really what you want here --dfp */
-
+ return 0; /* safety */
landown = sectp->sct_own;
shipown = sp->shp_own;
}
/* new autonav code.
- *
+ *
* 1. Try and move to the next sector/harbor given by the player.
* 2. Once we reach a harbor try and load all cargo holds for that ship.
* 3. If the ship reaches its max levels set by the player try to use
* the ship gets sunk (forts,ect..), the ship hits a mine.
*
* Questions, bugs (fixes) , or new ideas should be directed at
- * Chad Zabel.
- * 6-1-94
+ * Chad Zabel.
+ * 6-1-94
* Modified to use shp_nav by Ken Stevens 1995
*/
int
/* just return if no autonaving to do for this ship */
if (!(sp->shp_autonav & AN_AUTONAV) || (sp->shp_autonav & AN_STANDBY))
- return RET_OK;
+ return 0;
cnum = sp->shp_own;
shp_nav(&ship_list, &dummydouble, &dummydouble, &dummyint,
sp->shp_own);
if (QEMPTY(&ship_list))
- return RET_OK;
+ return 0;
cp = BestShipPath(buf, sp->shp_x, sp->shp_y,
sp->shp_destx[0], sp->shp_desty[0],
free(qp);
qp = newqp;
}
- return RET_SYN;
+ return -1;
}
stopping = 0;
free(qp);
qp = newqp;
}
- return RET_OK;
+ return 0;
}