/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2020, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
* Dave Pare, 1986
* Thomas Ruschak, 1993
* Steve McClure, 1998
- * Markus Armbruster, 2004-2011
+ * Markus Armbruster, 2004-2016
*/
#include <config.h>
#include <stdlib.h>
#include <sys/resource.h>
-#include "distribute.h"
+#include "optlist.h"
#include "path.h"
+#include "sect.h"
+#include "prototypes.h"
#include "update.h"
static void assemble_dist_paths(double *);
{
static double *import_cost;
struct sctstr *sp;
- struct natstr *np;
int n;
struct rusage rus1, rus2;
logerror("delivering...\n");
/* Do deliveries */
for (n = 0; NULL != (sp = getsectid(n)); n++) {
- if (sp->sct_type == SCT_WATER)
+ if (!sp->sct_own || sp->sct_type == SCT_SANCT)
continue;
- if (sp->sct_own == 0)
- continue;
- np = getnatp(sp->sct_own);
- if (np->nat_money < 0)
+ if (nat_budget[sp->sct_own].money < 0)
continue;
dodeliver(sp);
}
logerror("exporting...");
for (n = 0; NULL != (sp = getsectid(n)); n++) {
- if (!sp->sct_own)
+ if (!sp->sct_own || sp->sct_type == SCT_SANCT)
continue;
- np = getnatp(sp->sct_own);
- if (np->nat_money < 0)
+ if (nat_budget[sp->sct_own].money < 0)
continue;
dodistribute(sp, EXPORT, import_cost[n]);
}
logerror("importing...");
for (n = 0; NULL != (sp = getsectid(n)); n++) {
sp->sct_off = 0;
- if (!sp->sct_own)
+ if (!sp->sct_own || sp->sct_type == SCT_SANCT)
continue;
- np = getnatp(sp->sct_own);
- if (np->nat_money < 0)
+ if (nat_budget[sp->sct_own].money < 0)
continue;
dodistribute(sp, IMPORT, import_cost[n]);
}