]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/ship.c
Rearrange uses of getrel() slightly
[empserver] / src / lib / update / ship.c
index edc41b89423fa30aa99fe96e88db747135237b8e..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
@@ -31,7 +31,7 @@
  *     Dave Pare, 1986
  *     Steve McClure, 1996
  *     Ron Koenderink, 2004
- *     Markus Armbruster, 2006-2008
+ *     Markus Armbruster, 2006-2009
  */
 
 #include <config.h>
@@ -83,8 +83,6 @@ prod_ship(int etus, int natnum, struct bp *bp, int build)
        if (player->simulation)
            np->nat_money = start_money;
     }
-    bp_disable_cachepath();
-    bp_clear_cachepath();
 
     if (opt_SAIL) {
        if (build && !player->simulation)       /* make sure to only sail once */
@@ -149,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
@@ -265,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;