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

@ -58,7 +58,7 @@ update_main(void *unused)
int etu = etu_per_update;
int n;
int x;
int *bp;
struct bp *bp;
int cn, cn2, rel;
struct natstr *cnp;
struct natstr *np;
@ -92,7 +92,7 @@ update_main(void *unused)
memset(air_money, 0, sizeof(air_money));
memset(sea_money, 0, sizeof(sea_money));
memset(lnd_money, 0, sizeof(lnd_money));
bp = calloc(WORLD_X * WORLD_Y * 7, sizeof(int));
bp = alloc_bp();
for (n = 0; n < MAXNOC; n++) {
money[n] = 0;
if (!(np = getnatp(n)))