Replace the revolting build pointer data structure by a proper data

type.  Make it abstract because that's possible.  Change data layout
so that the slots belonging to a sector are together in memory, it's
nicer to the cache.
(bp): The new type.  Users changed.
(get_wp): Update accordingly.
(alloc_bp): New.
(update_main, calc_all): Use it.  Before, calc_all() allocated 1/7
more than necessary.
This commit is contained in:
Markus Armbruster 2007-01-13 09:07:59 +00:00
parent ac9cdf5bb9
commit 5507e8a1dc
13 changed files with 51 additions and 39 deletions

View file

@ -46,12 +46,12 @@
#include "update.h"
#include <math.h>
static void landrepair(struct lndstr *, struct natstr *, int *, int);
static void upd_land(struct lndstr *, int, struct natstr *, int *, int);
static void landrepair(struct lndstr *, struct natstr *, struct bp *, int);
static void upd_land(struct lndstr *, int, struct natstr *, struct bp *, int);
static int feed_land(struct lndstr *, int);
int
prod_land(int etus, int natnum, int *bp, int build)
prod_land(int etus, int natnum, struct bp *bp, int build)
/* build = 1, maintain = 0 */
{
struct lndstr *lp;
@ -104,7 +104,7 @@ prod_land(int etus, int natnum, int *bp, int build)
static void
upd_land(struct lndstr *lp, int etus,
struct natstr *np, int *bp, int build)
struct natstr *np, struct bp *bp, int build)
/* build = 1, maintain = 0 */
{
struct lchrstr *lcp;
@ -214,7 +214,7 @@ upd_land(struct lndstr *lp, int etus,
}
static void
landrepair(struct lndstr *land, struct natstr *np, int *bp, int etus)
landrepair(struct lndstr *land, struct natstr *np, struct bp *bp, int etus)
{
int delta;
struct sctstr *sp;