]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/unitsub.c
Update copyright notice
[empserver] / src / lib / subs / unitsub.c
index 4187fe6998414affa72226509f4e728174db9ff3..440fae7c703115e0c7911676f5896d8c3f243742 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  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
@@ -28,7 +28,7 @@
  *
  *  Known contributors to this file:
  *     Ron Koenderink, 2007
- *     Markus Armbruster, 2009-2013
+ *     Markus Armbruster, 2009-2014
  */
 
 #include <config.h>
@@ -116,42 +116,8 @@ unit_list(struct emp_qelem *unit_list)
     }
 }
 
-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;
@@ -165,10 +131,6 @@ unit_path(int together, struct empobj *unit, char *buf, size_t bufsz)
 
     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);
@@ -207,8 +169,7 @@ unit_path(int together, struct empobj *unit, char *buf, size_t bufsz)
           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;
 }
 
@@ -227,9 +188,9 @@ unit_view(struct emp_qelem *list)
            continue;
        getsect(ulp->unit.gen.x, ulp->unit.gen.y, &sect);
        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),
@@ -364,7 +325,6 @@ unit_wipe_orders(struct empobj *unit)
     struct shpstr *sp;
     struct plnstr *pp;
     struct lndstr *lp;
-    int i;
 
     unit->group = 0;
     unit->opx = unit->opy = 0;
@@ -374,18 +334,6 @@ unit_wipe_orders(struct empobj *unit)
     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;