]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/land.c
update: Rearrange code to pay non-sector military
[empserver] / src / lib / update / land.c
index ea2e7d08a8ff45ac83781b43a102f5c1cf2fdb02..23d3f228002b4e83c63bc9b4fd09afc4c9ef6bbd 100644 (file)
@@ -54,26 +54,45 @@ static void landrepair(struct lndstr *, struct natstr *, struct bp *,
                       int, struct budget *);
 static int feed_land(struct lndstr *, int);
 
-void
-prod_land(int etus, int natnum, struct bp *bp, int build)
-               /* build = 1, maintain = 0 */
+void prep_lands(int etus, natid natnum)
 {
+    int mil, i;
+    double mil_pay;
     struct lndstr *lp;
-    struct sctstr *sp;
-    int i;
 
     for (i = 0; (lp = getlandp(i)); i++) {
        if (lp->lnd_own == 0)
            continue;
        if (lp->lnd_own != natnum)
            continue;
-       if (lp->lnd_effic < LAND_MINEFF) {
+       if (CANT_HAPPEN(lp->lnd_effic < LAND_MINEFF)) {
            makelost(EF_LAND, lp->lnd_own, lp->lnd_uid,
                     lp->lnd_x, lp->lnd_y);
            lp->lnd_own = 0;
            continue;
        }
 
+       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;
+    }
+}
+
+void
+prod_land(int etus, int natnum, struct bp *bp, int build)
+               /* build = 1, maintain = 0 */
+{
+    struct lndstr *lp;
+    struct sctstr *sp;
+    int i;
+
+    for (i = 0; (lp = getlandp(i)); i++) {
+       if (lp->lnd_own == 0)
+           continue;
+       if (lp->lnd_own != natnum)
+           continue;
        sp = getsectp(lp->lnd_x, lp->lnd_y);
        if (sp->sct_type == SCT_SANCT)
            continue;