changeset 2192:e9a5563b8125

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 13 Oct 2019 02:07:19 +0300
parents aa51a5a3e4e8
children 2e1fb5766c28
files mkcitymap.c
diffstat 1 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mkcitymap.c	Sun Oct 13 02:06:24 2019 +0300
+++ b/mkcitymap.c	Sun Oct 13 02:07:19 2019 +0300
@@ -251,27 +251,28 @@
 
 void outputMapHTML(FILE *outFile, const MapBlock *map, const MapLocations *locs)
 {
-    int n, p = -1, c;
+    int n, p = -1;
     BOOL span = FALSE;
 
-    for (int y = 0; y < map->height; y++)
+    for (int yc = 0; yc < map->height; yc++)
     {
-        unsigned char *d = map->data + (map->scansize * y);
-        for (int x = 0; x < map->width; x++)
+        const unsigned char *dp = map->data + (map->scansize * yc);
+        for (int xc = 0; xc < map->width; xc++)
         {
-            if ((n = locFindByCoords(locs, x, y, TRUE)) >= 0)
+            if ((n = locFindByCoords(locs, xc, yc, TRUE)) >= 0)
             {
                 LocMarker *marker = locs->locations[n];
                 if (span) fprintf(outFile, "</span>");
 
-                if (marker->uri)
+                if (marker->uri != NULL)
                 {
-                    c = atoi(marker->uri);
-                    if (c < 0 || c >= nmapColors) c = 0;
+                    int color = atoi(marker->uri);
+                    if (color < 0 || color >= nmapColors)
+                        color = 0;
 
                     fprintf(outFile,
                     "<span class=\"%c\">%c</span>",
-                    'a' + c, *d);
+                    'a' + color, *dp);
                 }
                 else
                 {
@@ -284,24 +285,26 @@
                     'a' + col_light_red,
                     marker->xc, marker->yc,
                     marker->xc, marker->yc,
-                    marker->xc, marker->yc, *d);
+                    marker->xc, marker->yc,
+                    *dp);
                 }
                 span = FALSE;
                 p = -1;
             }
             else
             {
-                if (p != *d)
+                if (p != *dp)
                 {
+                    int color = muGetMapPieceColor(*dp, FALSE, TRUE);
                     if (span) fprintf(outFile, "</span>");
-                    c = muGetMapPieceColor(*d, FALSE, TRUE);
-                    fprintf(outFile, "<span class=\"%c\">", 'a' + c);
+                    fprintf(outFile, "<span class=\"%c\">",
+                        'a' + color);
                     span = TRUE;
                 }
-                fputc(*d, outFile);
-                p = *d;
+                fputc(*dp, outFile);
+                p = *dp;
             }
-            d++;
+            dp++;
         }
         if (span) fprintf(outFile, "</span>\n");
         p = -1;