]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/distribute.c
Remove dodistribute() parameter path
[empserver] / src / lib / update / distribute.c
index 12459c01458fccfc49b7126def038849bac759d7..7f86179e71d319bce58e146e7c7563b1dbcccba9 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
 #include "prototypes.h"
 #include "update.h"
 
+#ifdef DISTRIBUTE_DEBUG
+#define DPRINTF(fmt, ...) ((void)printf(fmt , ## __VA_ARGS__))
+#else
+#define DPRINTF(fmt, ...) ((void)0)
+#endif
+
 #define EXPORT_BONUS 10.0
 #define IMPORT_BONUS 10.0
 
 int
-dodistribute(struct sctstr *sp, int imex, char *path, double dist_i_cost,
-            double dist_e_cost)
-         /* import or export? */
+dodistribute(struct sctstr *sp, int imex,
+            double dist_i_cost, double dist_e_cost)
 {
     struct ichrstr *ip;
     struct sctstr *dist;
@@ -67,7 +72,7 @@ dodistribute(struct sctstr *sp, int imex, char *path, double dist_i_cost,
     if ((sp->sct_dist_x == sp->sct_x) && (sp->sct_dist_y == sp->sct_y))
        return 0;
 
-    if (!path) {
+    if (dist_e_cost < 0.0) {
        if (sp->sct_own != 0) {
            if (imex == EXPORT) /* only want this once */
                wu(0, sp->sct_own, "No path to dist sector for %s\n",
@@ -80,6 +85,10 @@ dodistribute(struct sctstr *sp, int imex, char *path, double dist_i_cost,
     dist_packing = dist->sct_effic >= 60 ? dchr[dist->sct_type].d_pkg : IPKG;
     sect_packing = sp->sct_effic   >= 60 ? dchr[sp->sct_type].d_pkg : IPKG;
 
+    DPRINTF("distribute: %d,%d to %d,%d pathcost %g\n",
+           sp->sct_x, sp->sct_y, sp->sct_dist_x, sp->sct_dist_y,
+           imex == IMPORT ? dist_i_cost : dist_e_cost);
+
     lplague = rplague = changed = 0;
     for (item = I_NONE + 1; item <= I_MAX; item++) {
        if (sp->sct_dist[item] == 0)