]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/ship.c
Rearrange uses of getrel() slightly
[empserver] / src / lib / update / ship.c
index 20a71ce1094e0d5808c847ca9e1794e178f51335..39f22c0e2e115bf1227e79aa42a24c5497eae9ba 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -147,7 +147,7 @@ upd_ship(struct shpstr *sp, int etus,
                product = &pchr[dchr[SCT_OIL].d_prd];
                oil_gained = roundavg(total_work(100, etus,
                                                 sp->shp_item[I_CIVIL],
-                                                sp->shp_item[I_MILIT],
+                                                sp->shp_item[I_MILIT],
                                                 sp->shp_item[I_UW],
                                                 ITEM_MAX)
                                      * sp->shp_effic / 100.0
@@ -263,19 +263,15 @@ shiprepair(struct shpstr *ship, struct natstr *np, struct bp *bp, int etus)
     int w_p_eff;
     int mult;
     int mvec[I_MAX + 1];
-    int rel;
 
     mp = &mchr[(int)ship->shp_type];
     sp = getsectp(ship->shp_x, ship->shp_y);
 
-    if ((sp->sct_own != ship->shp_own) && (sp->sct_own != 0)) {
-       rel = getrel(getnatp(sp->sct_own), ship->shp_own);
-
-       if (rel < FRIENDLY)
-           return;
-    }
+    if (sp->sct_own != 0
+       && sp->sct_own != ship->shp_own
+       && getrel(getnatp(sp->sct_own), ship->shp_own) < FRIENDLY)
+       return;
 
-    wf = 0;
     /* only military can work on a military boat */
     if (mp->m_glim != 0)
        wf = etus * ship->shp_item[I_MILIT] / 2;