/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2015, 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:
* Ron Koenderink, 2007
- * Markus Armbruster, 2009-2013
+ * Markus Armbruster, 2009-2014
*/
#include <config.h>
}
}
-void
-unit_put(struct emp_qelem *list, natid actor)
-{
- struct emp_qelem *qp;
- struct emp_qelem *newqp;
- struct ulist *ulp;
- struct empobj *unit;
-
- qp = list->q_back;
- while (qp != list) {
- ulp = (struct ulist *)qp;
- unit = &ulp->unit.gen;
- if (CANT_HAPPEN(unit->ef_type != EF_LAND
- && unit->ef_type != EF_SHIP))
- continue;
- if (actor) {
- mpr(actor, "%s stopped at %s\n", unit_nameof(unit),
- xyas(unit->x, unit->y, actor));
- if (unit->ef_type == EF_LAND) {
- if (ulp->mobil < -127)
- ulp->mobil = -127;
- unit->mobil = ulp->mobil;
- }
- }
- if (unit->ef_type == EF_SHIP)
- unit->mobil = (int)ulp->mobil;
- put_empobj(unit->ef_type, unit->uid, unit);
- newqp = qp->q_back;
- emp_remque(qp);
- free(qp);
- qp = newqp;
- }
-}
-
char *
-unit_path(int together, struct empobj *unit, char *buf, size_t bufsz)
+unit_path(struct empobj *unit, char *buf, size_t bufsz)
{
coord destx;
coord desty;
if (!sarg_xy(buf, &destx, &desty))
return buf;
- if (!together) {
- pr("Cannot go to a destination sector if not all starting in the same sector\n");
- return NULL;
- }
if (unit->ef_type == EF_SHIP) {
c = path_find(unit->x, unit->y, destx, desty,
player->cnum, MOB_SAIL);
xyas(destx, desty, player->cnum));
return NULL;
}
- if (unit->ef_type == EF_LAND)
- pr("Using path '%s'\n", buf);
+ pr("Using path '%s'\n", buf);
return buf;
}
continue;
getsect(ulp->unit.gen.x, ulp->unit.gen.y, §);
if (ulp->unit.gen.ef_type == EF_SHIP) {
- if (((struct mchrstr *)ulp->chrp)->m_flags & M_FOOD)
+ if (mchr[ulp->unit.ship.shp_type].m_flags & M_FOOD)
pr("[fert:%d] ", sect.sct_fertil);
- if (((struct mchrstr *)ulp->chrp)->m_flags & M_OIL)
+ if (mchr[ulp->unit.ship.shp_type].m_flags & M_OIL)
pr("[oil:%d] ", sect.sct_oil);
}
pr("%s @ %s %d%% %s\n", unit_nameof(&ulp->unit.gen),
struct shpstr *sp;
struct plnstr *pp;
struct lndstr *lp;
- int i;
unit->group = 0;
unit->opx = unit->opy = 0;
switch (unit->ef_type) {
case EF_SHIP:
sp = (struct shpstr *)unit;
- sp->shp_destx[0] = sp->shp_desty[0] = 0;
- sp->shp_destx[1] = sp->shp_desty[1] = 0;
- for (i = 0; i < TMAX; ++i) {
- sp->shp_tstart[i] = I_NONE;
- sp->shp_tend[i] = I_NONE;
- sp->shp_lstart[i] = 0;
- sp->shp_lend[i] = 0;
- }
- sp->shp_autonav = 0;
- sp->shp_mobquota = 0;
- sp->shp_path[0] = 0;
- sp->shp_follow = sp->shp_uid;
sp->shp_rflags = 0;
sp->shp_rpath[0] = 0;
break;