/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2016, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2017, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
#include <config.h>
-#include <math.h>
#include "chance.h"
-#include "file.h"
#include "land.h"
#include "lost.h"
#include "nat.h"
static void plague_land(struct lndstr *, int);
static void landrepair(struct lndstr *, struct natstr *, struct bp *,
int, struct budget *);
-static int feed_land(struct lndstr *, int);
-void prep_lands(int etus, natid natnum)
+void prep_lands(int etus, struct bp *bp)
{
- int mil, i;
+ int mil, i, n;
double mil_pay;
struct lndstr *lp;
for (i = 0; (lp = getlandp(i)); i++) {
if (lp->lnd_own == 0)
continue;
- if (lp->lnd_own != natnum)
- continue;
if (CANT_HAPPEN(lp->lnd_effic < LAND_MINEFF)) {
makelost(EF_LAND, lp->lnd_own, lp->lnd_uid,
lp->lnd_x, lp->lnd_y);
continue;
}
+ bp_consider_unit(bp, (struct empobj *)lp);
mil = lp->lnd_item[I_MILIT];
mil_pay = mil * etus * money_mil;
- nat_budget[natnum].mil.count += mil;
- nat_budget[natnum].mil.money += mil_pay;
- nat_budget[natnum].money += mil_pay;
+ nat_budget[lp->lnd_own].mil.count += mil;
+ nat_budget[lp->lnd_own].mil.money += mil_pay;
+ nat_budget[lp->lnd_own].money += mil_pay;
+
+ if (!player->simulation) {
+ if ((n = feed_people(lp->lnd_item, etus)) > 0) {
+ wu(0, lp->lnd_own, "%d starved in %s\n", n, prland(lp));
+ if (n > 10)
+ nreport(lp->lnd_own, N_DIE_FAMINE, 0, 1);
+ }
+ plague_land(lp, etus);
+ }
}
}
void
-prod_land(int etus, int natnum, struct bp *bp, int build)
+prod_land(int etus, struct bp *bp, int build)
/* build = 1, maintain = 0 */
{
struct lndstr *lp;
for (i = 0; (lp = getlandp(i)); i++) {
if (lp->lnd_own == 0)
continue;
- if (lp->lnd_own != natnum)
+ if (bp_skip_unit(bp, (struct empobj *)lp))
continue;
upd_land(lp, etus, bp, build);
}
struct lchrstr *lcp = &lchr[lp->lnd_type];
struct natstr *np = getnatp(lp->lnd_own);
int min = morale_base - (int)np->nat_level[NAT_HLEV];
- int n, mult, eff_lost;
+ int mult, eff_lost;
double cost;
if (!player->simulation)
budget->bm[BUDG_LND_MAINT].money -= cost;
budget->money -= cost;
}
-
- if (!player->simulation) {
- /* feed */
- if ((n = feed_land(lp, etus)) > 0) {
- wu(0, lp->lnd_own, "%d starved in %s\n", n, prland(lp));
- if (n > 10)
- nreport(lp->lnd_own, N_DIE_FAMINE, 0, 1);
- }
- plague_land(lp, etus);
- } /* end !player->simulation */
}
}
if (!player->simulation)
land->lnd_effic += (signed char)build;
}
-
-/*
- * returns the number who starved, if any.
- */
-static int
-feed_land(struct lndstr *lp, int etus)
-{
- return feed_people(lp->lnd_item, etus);
-}