/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* star.c: Do a starvation report
- *
+ *
* Known contributors to this file:
- *
+ *
*/
#include <config.h>
#include <math.h>
-#include "misc.h"
-#include "player.h"
-#include "xy.h"
-#include "sect.h"
-#include "nsc.h"
-#include "nat.h"
-#include "path.h"
-#include "file.h"
+#include "commands.h"
#include "item.h"
-#include "ship.h"
-#include "optlist.h"
#include "land.h"
-#include "commands.h"
+#include "optlist.h"
+#include "path.h"
+#include "ship.h"
static void starv_sects(char *range);
static void starv_ships(char *range);
struct nstr_sect nstr;
struct sctstr sect;
int nsect = 0;
- int s;
+ int s, save;
if (!snxtsct(&nstr, range))
return;
if (sect.sct_type == SCT_SANCT)
continue;
+ /*
+ * Check for starvation. Suppress complaints about tiny
+ * population without food by adding 1f just for the check.
+ * That's okay because growfood() will grow at least that much
+ * anyway.
+ */
+ save = sect.sct_item[I_FOOD];
if (sect.sct_item[I_FOOD] == 0)
- sect.sct_item[I_FOOD] = 1; /* see growfood() */
+ sect.sct_item[I_FOOD] = 1;
s = famine_victims(sect.sct_item, etu_per_update);
-
+ sect.sct_item[I_FOOD] = save;
if (s == 0)
continue;
+
if (nsect++ == 0)
sect_hdr();
if (player->god)
int nship = 0;
int s;
- if (!snxtitem(&ni, EF_SHIP, range))
+ if (!snxtitem(&ni, EF_SHIP, range, NULL))
return;
while (nxtitem(&ni, &ship)) {
struct nstr_item ni;
struct lndstr land;
int nunit = 0;
- int s, needed;
+ int s;
- if (!snxtitem(&ni, EF_LAND, range))
+ if (!snxtitem(&ni, EF_LAND, range, NULL))
return;
while (nxtitem(&ni, &land)) {