]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/finish.c
Update copyright notice
[empserver] / src / lib / update / finish.c
index 785faa3dc65dd506953c421b035baec1317ab01b..0725602131d494df344173a2311bd2b3297bc99c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
 
 #include <config.h>
 
-#include "misc.h"
-#include "sect.h"
-#include "nat.h"
-#include "file.h"
-#include "xy.h"
-#include "path.h"
 #include "distribute.h"
+#include "path.h"
 #include "update.h"
-#include "common.h"
-#include "optlist.h"
+#include <stdlib.h>
 
 /* Used for building up distribution info */
 struct distinfo {
@@ -83,20 +77,15 @@ finish_sects(int etu)
     if (g_distptrs == NULL) {
        logerror("First update since reboot, allocating buffer\n");
        /* Allocate the information buffer */
-       g_distptrs = (struct distinfo *)(malloc((WORLD_X * WORLD_Y) *
-                                               sizeof(struct distinfo)));
+       g_distptrs = malloc(WORLD_SZ() * sizeof(*g_distptrs));
        if (g_distptrs == NULL) {
            logerror("malloc failed in finish_sects.\n");
            return;
        }
-
-       logerror("Allocated '%lu' bytes '%d' indices\n",
-                (unsigned long)(WORLD_X * WORLD_Y * sizeof(struct distinfo)),
-                WORLD_X * WORLD_Y);
     }
 
     /* Wipe it clean */
-    memset(g_distptrs, 0, ((WORLD_X * WORLD_Y) * sizeof(struct distinfo)));
+    memset(g_distptrs, 0, WORLD_SZ() * sizeof(*g_distptrs));
 
     logerror("delivering...\n");
     /* Do deliveries */
@@ -168,6 +157,8 @@ finish_sects(int etu)
        if (infptr->path)
            free(infptr->path);
 #endif /* SAVE_FINISH_PATHS */
+
+       sp->sct_off = 0;
     }
     logerror("done importing\n");