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:
parent
ac9cdf5bb9
commit
5507e8a1dc
13 changed files with 51 additions and 39 deletions
|
@ -42,11 +42,11 @@
|
|||
#include "ship.h"
|
||||
#include "update.h"
|
||||
|
||||
static void planerepair(struct plnstr *, struct natstr *, int *, int);
|
||||
static void upd_plane(struct plnstr *, int, struct natstr *, int *, int);
|
||||
static void planerepair(struct plnstr *, struct natstr *, struct bp *, int);
|
||||
static void upd_plane(struct plnstr *, int, struct natstr *, struct bp *, int);
|
||||
|
||||
int
|
||||
prod_plane(int etus, int natnum, int *bp, int buildem)
|
||||
prod_plane(int etus, int natnum, struct bp *bp, int buildem)
|
||||
/* Build = 1, maintain =0 */
|
||||
{
|
||||
struct plnstr *pp;
|
||||
|
@ -88,7 +88,7 @@ prod_plane(int etus, int natnum, int *bp, int buildem)
|
|||
|
||||
static void
|
||||
upd_plane(struct plnstr *pp, int etus,
|
||||
struct natstr *np, int *bp, int build)
|
||||
struct natstr *np, struct bp *bp, int build)
|
||||
{
|
||||
struct plchrstr *pcp = &plchr[(int)pp->pln_type];
|
||||
int mult, cost, eff;
|
||||
|
@ -125,7 +125,7 @@ upd_plane(struct plnstr *pp, int etus,
|
|||
}
|
||||
|
||||
static void
|
||||
planerepair(struct plnstr *pp, struct natstr *np, int *bp, int etus)
|
||||
planerepair(struct plnstr *pp, struct natstr *np, struct bp *bp, int etus)
|
||||
{
|
||||
int build;
|
||||
int mvec[I_MAX + 1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue