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
|
@ -47,12 +47,12 @@
|
|||
#include "ship.h"
|
||||
#include "update.h"
|
||||
|
||||
static void shiprepair(struct shpstr *, struct natstr *, int *, int);
|
||||
static void upd_ship(struct shpstr *, int, struct natstr *, int *, int);
|
||||
static void shiprepair(struct shpstr *, struct natstr *, struct bp *, int);
|
||||
static void upd_ship(struct shpstr *, int, struct natstr *, struct bp *, int);
|
||||
static int feed_ship(struct shpstr *, int);
|
||||
|
||||
int
|
||||
prod_ship(int etus, int natnum, int *bp, int build)
|
||||
prod_ship(int etus, int natnum, struct bp *bp, int build)
|
||||
/* build = 1, maintain = 0 */
|
||||
{
|
||||
struct shpstr *sp;
|
||||
|
@ -107,7 +107,7 @@ prod_ship(int etus, int natnum, int *bp, int build)
|
|||
|
||||
static void
|
||||
upd_ship(struct shpstr *sp, int etus,
|
||||
struct natstr *np, int *bp, int build)
|
||||
struct natstr *np, struct bp *bp, int build)
|
||||
/* build = 1, maintain = 0 */
|
||||
{
|
||||
struct sctstr *sectp;
|
||||
|
@ -266,7 +266,7 @@ upd_ship(struct shpstr *sp, int etus,
|
|||
* 8 * 8 * $40 = $2560!
|
||||
*/
|
||||
static void
|
||||
shiprepair(struct shpstr *ship, struct natstr *np, int *bp, int etus)
|
||||
shiprepair(struct shpstr *ship, struct natstr *np, struct bp *bp, int etus)
|
||||
{
|
||||
int delta;
|
||||
struct sctstr *sp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue