]> git.pond.sub.org Git - empserver/commitdiff
update: Drop redundant bp_put_items() parameter vec[]
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 3 Jun 2016 18:58:54 +0000 (20:58 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 17:59:57 +0000 (19:59 +0200)
All its callers pass sp->sct_item, so use that.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
include/budg.h
src/lib/update/bp.c
src/lib/update/sect.c

index 389c024cf40cf29afb4ab1574915e44ee5dcbc68..f16cd865d023319b423945716f81a35d08b0ee29 100644 (file)
@@ -45,7 +45,7 @@ struct bp *bp_alloc(void);
 void bp_set_from_sect(struct bp *, struct sctstr *);
 int bp_get_item(struct bp *, struct sctstr *, i_type);
 void bp_put_item(struct bp *, struct sctstr *, i_type, int);
-void bp_put_items(struct bp *, struct sctstr *, short *);
+void bp_put_items(struct bp *, struct sctstr *);
 int bp_get_avail(struct bp *, struct sctstr *);
 void bp_put_avail(struct bp *, struct sctstr *, int);
 
index ec7d24b64ea404c4f89da8cba21eb2aeea5d9eea..877c8bd47175bb12309bd84e2b5ad3e8d0d2ceff 100644 (file)
@@ -28,7 +28,7 @@
  *
  *  Known contributors to this file:
  *     Ville Virrankoski, 1996
- *     Markus Armbruster, 2007
+ *     Markus Armbruster, 2007-2016
  */
 
 /*
@@ -99,9 +99,9 @@ bp_put_item(struct bp *bp, struct sctstr *sp, i_type comm, int amount)
        bp_ref(bp, sp)->bp_item[idx] = amount;
 }
 
-/* Set the item values tracked in @bp for sector @sp from @vec. */
+/* Set the item values tracked in @bp from sector @sp. */
 void
-bp_put_items(struct bp *bp, struct sctstr *sp, short *vec)
+bp_put_items(struct bp *bp, struct sctstr *sp)
 {
     enum bp_item_idx idx;
     struct bp *p = bp_ref(bp, sp);
@@ -110,7 +110,7 @@ bp_put_items(struct bp *bp, struct sctstr *sp, short *vec)
     for (i = I_NONE + 1; i <= I_MAX; i++) {
        idx = bud_key[i];
        if (idx >= 0)
-           p->bp_item[idx] = vec[i];
+           p->bp_item[idx] = sp->sct_item[i];
     }
 }
 
@@ -132,7 +132,7 @@ bp_put_avail(struct bp *bp, struct sctstr *sp, int amount)
 void
 bp_set_from_sect(struct bp *bp, struct sctstr *sp)
 {
-    bp_put_items(bp, sp, sp->sct_item);
+    bp_put_items(bp, sp);
     bp_put_avail(bp, sp, sp->sct_avail);
 }
 
index fbfac5cee43b3ff334464aaf1b1b0312892bfb56..324ef911a85669d6de4c40735bcc27bcfb3992c2 100644 (file)
@@ -288,7 +288,7 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2])
        work = 0;
 
        do_feed(sp, np, sp->sct_item, &work, etu);
-       bp_put_items(bp, sp, sp->sct_item);
+       bp_put_items(bp, sp);
 
        if (sp->sct_off || np->nat_money < 0)
            continue;
@@ -310,7 +310,7 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2])
        if ((sp->sct_effic < 100 || sp->sct_type != sp->sct_newtype) &&
            np->nat_money >= 0) {
            neweff = upd_buildeff(sp, &work, sp->sct_item, &desig, &cost);
-           bp_put_items(bp, sp, sp->sct_item);
+           bp_put_items(bp, sp);
            p_sect[SCT_EFFIC][0]++;
            p_sect[SCT_EFFIC][1] += cost;
            if (!player->simulation) {
@@ -326,7 +326,7 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2])
            p_sect[desig][1] += ecost;
            if (!player->simulation)
                np->nat_money -= ecost;
-           bp_put_items(bp, sp, sp->sct_item);
+           bp_put_items(bp, sp);
        }
 
        /*
@@ -337,7 +337,7 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2])
            if (np->nat_money >= 0 && dchr[desig].d_prd >= 0)
                work -= produce(np, sp, sp->sct_item, work, desig, neweff,
                                &pcost, &amount);
-           bp_put_items(bp, sp, sp->sct_item);
+           bp_put_items(bp, sp);
        }
 
        bp_put_avail(bp, sp, work);