Mercurial > hg > batmud > maputils
changeset 2071:38436de1bbc8
Rename MapLocations::n to MapLocations::nlocations.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 21 Aug 2019 13:41:38 +0300 |
parents | 8d41b9055858 |
children | 5d6ae2aa8c56 |
files | liblocfile.c liblocfile.h mapsearch.c mkcitymap.c mkloc.c |
diffstat | 5 files changed, 29 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/liblocfile.c Wed Aug 21 13:37:11 2019 +0300 +++ b/liblocfile.c Wed Aug 21 13:41:38 2019 +0300 @@ -68,10 +68,10 @@ if (dst == NULL || src == NULL) return; - dst->n = src->n; - dst->locations = (LocMarker **) th_malloc(dst->n * sizeof(LocMarker *)); + dst->nlocations = src->nlocations; + dst->locations = (LocMarker **) th_malloc(dst->nlocations * sizeof(LocMarker *)); - for (int i = 0; i < dst->n; i++) + for (int i = 0; i < dst->nlocations; i++) dst->locations[i] = locCopyLocMarker(src->locations[i]); } @@ -118,13 +118,13 @@ // Add new location l->locations = (LocMarker **) th_realloc(l->locations, - sizeof(LocMarker*) * (l->n+1)); + sizeof(LocMarker*) * (l->nlocations+1)); if (l->locations == NULL) return FALSE; - l->locations[l->n] = tmp; - l->n++; + l->locations[l->nlocations] = tmp; + l->nlocations++; return TRUE; } @@ -132,7 +132,7 @@ int locFindByCoords(const MapLocations *l, const int x, const int y, const BOOL locTrue) { - for (int i = 0; i < l->n; i++) + for (int i = 0; i < l->nlocations; i++) { LocMarker *tmp = l->locations[i]; if (locTrue) @@ -168,7 +168,7 @@ { if (loc->locations != NULL) { - for (int i = 0; i < loc->n; i++) + for (int i = 0; i < loc->nlocations; i++) if (loc->locations[i] != NULL) { locFreeMarkerData(loc->locations[i]);
--- a/liblocfile.h Wed Aug 21 13:37:11 2019 +0300 +++ b/liblocfile.h Wed Aug 21 13:41:38 2019 +0300 @@ -129,7 +129,7 @@ typedef struct { - int n; + int nlocations; LocMarker **locations; } MapLocations;
--- a/mapsearch.c Wed Aug 21 13:37:11 2019 +0300 +++ b/mapsearch.c Wed Aug 21 13:41:38 2019 +0300 @@ -1206,7 +1206,7 @@ for (int nmap = 0; nmap < optNMaps; nmap++) { MAPInfoCtx *info = &optMaps[nmap]; - for (int nloc = 0; nloc < info->loc.n; nloc++) + for (int nloc = 0; nloc < info->loc.nlocations; nloc++) { LocMarker *marker = info->loc.locations[nloc]; for (int nname = 0; nname < marker->nnames; nname++)
--- a/mkcitymap.c Wed Aug 21 13:37:11 2019 +0300 +++ b/mkcitymap.c Wed Aug 21 13:41:38 2019 +0300 @@ -103,11 +103,11 @@ void outputLocationBlockHTML(FILE *outFile, const MapLocations *locs, int start, int end) { - if (start >= locs->n || start < 0 || start > end) + if (start >= locs->nlocations || start < 0 || start > end) return; - if (end >= locs->n) - end = locs->n-1; + if (end >= locs->nlocations) + end = locs->nlocations - 1; fprintf(outFile, "<td>\n"); @@ -274,7 +274,7 @@ "<table><tr>\n" ); - for (num = n = 0; n < locs->n; n++) + for (num = n = 0; n < locs->nlocations; n++) if (locs->locations[n] != NULL) { LocMarker *tmp = locs->locations[n]; @@ -283,7 +283,7 @@ } k = (num / (optUseTable ? 2 : 4)) + 1; - for (n = 0; n < locs->n; n += k) + for (n = 0; n < locs->nlocations; n += k) outputLocationBlockHTML(outFile, locs, n, n + k - 1); fprintf(outFile, @@ -300,7 +300,7 @@ ); } - for (n = 0; n < locs->n; n++) + for (n = 0; n < locs->nlocations; n++) if (locs->locations[n] != NULL) { LocMarker *tmp = locs->locations[n];
--- a/mkloc.c Wed Aug 21 13:37:11 2019 +0300 +++ b/mkloc.c Wed Aug 21 13:41:38 2019 +0300 @@ -273,7 +273,7 @@ */ void adjustLocInfoCoords(MapBlock *map, MapLocations *l) { - for (int i = 0; i < l->n; i++) + for (int i = 0; i < l->nlocations; i++) { int y, x0, x1, len; LocMarker *tmp = l->locations[i]; @@ -460,7 +460,7 @@ */ void maplocSort(MapLocations *l) { - for (int i = 0; i < l->n; i++) + for (int i = 0; i < l->nlocations; i++) { LocMarker *loc = l->locations[i]; loc->val = 2; @@ -482,7 +482,7 @@ } } - qsort(l->locations, l->n, sizeof(LocMarker *), maplocCompare); + qsort(l->locations, l->nlocations, sizeof(LocMarker *), maplocCompare); } @@ -591,7 +591,7 @@ fprintf(outFile, "<option value=\"\">-</option>\n"); - for (int i = 0; i < l->n; i++) + for (int i = 0; i < l->nlocations; i++) { LocMarker *tmp = l->locations[i]; @@ -636,7 +636,7 @@ ); // Output each location entry - for (int i = 0; i < l->n; i++) + for (int i = 0; i < l->nlocations; i++) { LocMarker *tmp = l->locations[i]; @@ -744,7 +744,7 @@ numCity = numLoc = numTotal = 0; // Output instructions for each visible location - for (int i = 0; i < l->n; i++) + for (int i = 0; i < l->nlocations; i++) { LocMarker *tmp = l->locations[i]; int x, y, leftMove; @@ -994,7 +994,7 @@ "<markers>\n"); // Output each location entry - for (int i = 0; i < l->n; i++) + for (int i = 0; i < l->nlocations; i++) { LocMarker *tmp = l->locations[i]; @@ -1037,7 +1037,7 @@ fprintf(outFile, "[\n"); // Output each location entry - for (int i = 0; i < l->n; i++) + for (int i = 0; i < l->nlocations; i++) { LocMarker *tmp = l->locations[i]; @@ -1067,7 +1067,7 @@ } fprintf(outFile, "}%s\n", - (i < l->n - 1) ? "," : ""); + (i < l->nlocations - 1) ? "," : ""); } fprintf(outFile, "]\n"); @@ -1167,7 +1167,7 @@ { THMSG(1, "Scaling locations ..\n"); - for (int i = 0; i < worldLoc.n; i++) + for (int i = 0; i < worldLoc.nlocations; i++) { LocMarker *tmp = worldLoc.locations[i]; @@ -1198,14 +1198,14 @@ case OUTFMT_LOCFILE: THMSG(1, "Outputting generated location list ...\n"); outputLocationFile(outFile, &worldLoc); - THMSG(2, "%d locations\n", worldLoc.n); + THMSG(2, "%d locations\n", worldLoc.nlocations); break; case OUTFMT_MAPLOC: maplocSort(&worldLoc); THMSG(1, "Outputting MapLoc HTML ...\n"); outputMapLocHTML(outFile, &worldLoc); - THMSG(2, "%d locations\n", worldLoc.n); + THMSG(2, "%d locations\n", worldLoc.nlocations); break; case OUTFMT_GMAPS: @@ -1216,7 +1216,7 @@ case GMAPS_XML: outputGMapsXML(outFile, &worldLoc); break; case GMAPS_JSON: outputGMapsJSON(outFile, &worldLoc); break; } - THMSG(2, "%d locations\n", worldLoc.n); + THMSG(2, "%d locations\n", worldLoc.nlocations); break; case OUTFMT_MAP: