Use sctstr member sct_uid instead of recomputing it

The old code recomputed it with sctoff() in some places, without
checking for failure.  Not a bug, because it can't actually fail, just
confusing.
This commit is contained in:
Markus Armbruster 2008-03-24 10:53:56 +01:00
parent f18502a1d1
commit a0fa4550a8
8 changed files with 11 additions and 11 deletions

View file

@ -125,7 +125,7 @@ finish_sects(int etu)
if (np->nat_money < 0)
continue;
/* Get the pointer */
infptr = &g_distptrs[XYOFFSET(sp->sct_x, sp->sct_y)];
infptr = &g_distptrs[sp->sct_uid];
dodistribute(sp, EXPORT,
infptr->path, infptr->imcost, infptr->excost);
}
@ -135,7 +135,7 @@ finish_sects(int etu)
logerror("importing...");
for (n = 0; NULL != (sp = getsectid(n)); n++) {
/* Get the pointer (we do it first so we can free if needed) */
infptr = &g_distptrs[XYOFFSET(sp->sct_x, sp->sct_y)];
infptr = &g_distptrs[sp->sct_uid];
if (sp->sct_type == SCT_WATER || sp->sct_own == 0) {
#ifdef SAVE_FINISH_PATHS
if (infptr->path)
@ -179,7 +179,7 @@ assemble_dist_paths(struct distinfo *distptrs)
if ((sp->sct_dist_x == sp->sct_x) && (sp->sct_dist_y == sp->sct_y))
continue;
/* Set the pointer */
infptr = &distptrs[XYOFFSET(sp->sct_x, sp->sct_y)];
infptr = &distptrs[sp->sct_uid];
/* now, get the dist sector */
dist = getsectp(sp->sct_dist_x, sp->sct_dist_y);
if (dist == NULL) {