]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/sect.c
Update copyright notice
[empserver] / src / lib / update / sect.c
index 7e569a0297d9feeaa72fc2d4008ac8908862abcb..8deaad82fa57b797fc4eaa3188eb2c5f1fe28574 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -278,13 +278,6 @@ produce_sect(int natnum, int etu, struct bp *bp, long p_sect[][2])
 
        np = getnatp(natnum);
 
-       if (sp->sct_type == SCT_CAPIT && sp->sct_effic >= 60) {
-           p_sect[SCT_CAPIT][0]++;
-           p_sect[SCT_CAPIT][1] += etu;
-           if (!player->simulation)
-               np->nat_money -= etu;
-       }
-
        if (player->simulation) {
            /* work on a copy, which will be discarded */
            memcpy(buf, sp->sct_item, sizeof(buf));
@@ -297,7 +290,7 @@ produce_sect(int natnum, int etu, struct bp *bp, long p_sect[][2])
         * they all starved or were plagued off.
         */
        if (vec[I_CIVIL] == 0 && vec[I_MILIT] == 0 &&
-           !has_units(sp->sct_x, sp->sct_y, sp->sct_own, 0)) {
+           !has_units(sp->sct_x, sp->sct_y, sp->sct_own, NULL)) {
            if (!player->simulation) {
                makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
                sp->sct_own = 0;
@@ -321,6 +314,14 @@ produce_sect(int natnum, int etu, struct bp *bp, long p_sect[][2])
 
        desig = sp->sct_type;
 
+       if (dchr[desig].d_maint) {
+           cost = etu * dchr[desig].d_maint;
+           p_sect[SCT_MAINT][0]++;
+           p_sect[SCT_MAINT][1] += cost;
+           if (!player->simulation)
+               np->nat_money -= cost;
+       }
+
        if ((sp->sct_effic < 100 || sp->sct_type != sp->sct_newtype) &&
            np->nat_money >= 0) {
            neweff = upd_buildeff(np, sp, &work, vec, etu, &desig, sctwork,