]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/land.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / update / land.c
index b653ef8bd21bfeb1abefecee33164bd1ac9d122d..64af50b7acef1b8ddba84c553e9e00fd9e9256bc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
@@ -33,6 +33,8 @@
  *     Steve McClure, 1996
  */
 
+#include <config.h>
+
 #include "misc.h"
 #include "plague.h"
 #include "sect.h"
@@ -41,7 +43,6 @@
 #include "ship.h"
 #include "news.h"
 #include "file.h"
-#include "product.h"
 #include "optlist.h"
 #include "budg.h"
 #include "player.h"
 
 int mil_dbl_pay;
 
-#ifndef MIN
-#define MIN(x,y)       ((x) > (y) ? (y) : (x))
-#endif
-
 static int landrepair(struct lndstr *, struct natstr *,
                      int *, int);
 static void upd_land(struct lndstr *lp, int etus,
@@ -98,7 +95,7 @@ prod_land(int etus, int natnum, int *bp, int build)
        start_money = np->nat_money;
        upd_land(lp, etus, np, bp, build);
        lnd_money[lp->lnd_own] += np->nat_money - start_money;
-       if ((build && (np->nat_money != start_money)) || (!build))
+       if (!build || np->nat_money != start_money)
            k++;
        if (player->simulation)
            np->nat_money = start_money;
@@ -115,7 +112,7 @@ upd_land(struct lndstr *lp, int etus,
               /* build = 1, maintain = 0 */
 {
     struct lchrstr *lcp;
-    u_short pstage, ptime;
+    int pstage, ptime;
     int n;
     int min = morale_base - (int)np->nat_level[NAT_HLEV];
     int mult;
@@ -143,8 +140,8 @@ upd_land(struct lndstr *lp, int etus,
            mult = 2;
        if (lcp->l_flags & L_ENGINEER)
            mult *= 3;
-/*             cost = -(mult * etus * dmin(0.0, money_land * LND_COST(lcp->l_cost, lp->lnd_tech - lcp->l_tech)));*/
-       cost = -(mult * etus * dmin(0.0, money_land * lcp->l_cost));
+/*             cost = -(mult * etus * MIN(0.0, money_land * LND_COST(lcp->l_cost, lp->lnd_tech - lcp->l_tech)));*/
+       cost = -(mult * etus * MIN(0.0, money_land * lcp->l_cost));
        if ((np->nat_priorities[PRI_LMAINT] == 0 || np->nat_money < cost)
            && !player->simulation) {
            if ((eff = lp->lnd_effic - etus / 5) < LAND_MINEFF) {
@@ -270,8 +267,8 @@ landrepair(struct lndstr *land, struct natstr *np,
     delta = roundavg((double)avail / w_p_eff);
     if (delta <= 0)
        return 1;
-    if (delta > etus * land_grow_scale)
-       delta = etus * land_grow_scale;
+    if (delta > (int)((float)etus * land_grow_scale))
+       delta = (int)((float)etus * land_grow_scale);
 
     /* delta is the max amount we can grow */