changeset 2407:47139c50cdc2

Rename function arguments and variables for clarity.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 10 Nov 2021 10:14:31 +0200
parents 1573d5040b55
children f2e639d72f6f
files src/mkloc.c
diffstat 1 files changed, 42 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/src/mkloc.c	Wed Nov 10 10:05:48 2021 +0200
+++ b/src/mkloc.c	Wed Nov 10 10:14:31 2021 +0200
@@ -284,12 +284,12 @@
 
 /* Adjust location label coordinates for the ASCII-CTRL map
  */
-void adjustLocInfoCoords(MapBlock *map, MapLocations *l)
+void adjustLocInfoCoords(MapBlock *map, MapLocations *lp)
 {
-    for (int i = 0; i < l->nlocations; i++)
+    for (int i = 0; i < lp->nlocations; i++)
     {
         int yc, x0, x1, len;
-        LocMarker *tmp = l->locations[i];
+        LocMarker *tmp = lp->locations[i];
 
         len = strlen(tmp->names[0].name);
         if (optLabelType)
@@ -373,28 +373,28 @@
     THMSG(2, "Updating location information ..\n");
 
     // Find new, unknown locations
-    for (int y = 0; y < worldMap->height; y++)
+    for (int yc = 0; yc < worldMap->height; yc++)
     {
-        unsigned char *dp = worldMap->data + (worldMap->scansize * y);
+        unsigned char *dp = worldMap->data + (worldMap->scansize * yc);
 
-        for (int x = 0; x < worldMap->width; x++)
+        for (int xc = 0; xc < worldMap->width; xc++)
         {
-            if (muStrChr((unsigned char *) optLocMarkers, noptLocMarkers, dp[x]))
+            if (muStrChr((unsigned char *) optLocMarkers, noptLocMarkers, dp[xc]))
             {
                 LocName tmpNames[LOC_MAX_NAMES];
                 char tmpDesc[512];
                 int tmpFlags;
 
                 // Check for new locations
-                if (locFindByCoords(worldLoc, x, y, TRUE) >= 0)
+                if (locFindByCoords(worldLoc, xc, yc, TRUE) >= 0)
                     continue;
 
 
-                if (dp[x] == 'C')
+                if (dp[xc] == 'C')
                 {
                     // In case of player cities, check for existing adjacent blocks
                     // so we can match with an existing pcity ..
-                    n = checkForAdjacent(worldLoc, x, y, LOCF_M_PCITY);
+                    n = checkForAdjacent(worldLoc, xc, yc, LOCF_M_PCITY);
                     if (n >= 0)
                     {
                         // Found, use its name for this block
@@ -426,13 +426,13 @@
 
                 memset(tmpNames, 0, sizeof(tmpNames));
                 tmpNames[0].name = tmpDesc;
-                locAddNew(worldLoc, x, y, LOCD_NONE, tmpFlags,
+                locAddNew(worldLoc, xc, yc, LOCD_NONE, tmpFlags,
                     tmpNames, NULL, NULL, FALSE, NULL, NULL, NULL);
             }
             else
             {
                 // Check for misplaced locations
-                if ((n = locFindByCoords(worldLoc, x, y, TRUE)) >= 0)
+                if ((n = locFindByCoords(worldLoc, xc, yc, TRUE)) >= 0)
                 {
                     tmpl = worldLoc->locations[n];
 
@@ -507,19 +507,19 @@
 /* Output the map with labels and location markers, etc. in
  * special ASCII-CTRL format understood by colormap utility.
  */
-void outputMapCTRL(FILE *outFile, MapBlock *map, MapLocations *l)
+void outputMapCTRL(FILE *outFile, MapBlock *map, MapLocations *lp)
 {
-    for (int y = 0; y < map->height; y++)
+    for (int yc = 0; yc < map->height; yc++)
     {
-        unsigned char *dp = map->data + (map->scansize * y);
+        unsigned char *dp = map->data + (map->scansize * yc);
 
-        for (int x = 0; x < map->width; x++)
+        for (int xc = 0; xc < map->width; xc++)
         {
             int n;
-            if ((n = locFindByCoords(l, x, y, TRUE)) >= 0)
+            if ((n = locFindByCoords(lp, xc, yc, TRUE)) >= 0)
             {
-                LocMarker *tmp = l->locations[n];
-                char chm = dp[x];
+                LocMarker *tmp = lp->locations[n];
+                char chm = dp[xc];
 
                 switch (tmp->flags & LOCF_M_MASK)
                 {
@@ -541,9 +541,9 @@
                 fputc(0xfe, outFile);
             }
             else
-            if (!optNoLabels && (n = locFindByCoords(l, x, y, FALSE)) >= 0)
+            if (!optNoLabels && (n = locFindByCoords(lp, xc, yc, FALSE)) >= 0)
             {
-                LocMarker *tmp = l->locations[n];
+                LocMarker *tmp = lp->locations[n];
 
                 if ((tmp->flags & LOCF_INVIS) == 0)
                 {
@@ -578,22 +578,22 @@
 
                     if (optLabelType)
                     {
-                        x += locPrintType(outFile, tmp, !optNoAdjust, NULL, FALSE);
+                        xc += locPrintType(outFile, tmp, !optNoAdjust, NULL, FALSE);
                     }
 
                     fputs(tmp->names[0].name, outFile);
                     fputc(0xfe, outFile);
 
                     if (!optNoAdjust)
-                        x += strlen(tmp->names[0].name) - 1;
+                        xc += strlen(tmp->names[0].name) - 1;
                     else
-                        fputc(dp[x], outFile);
+                        fputc(dp[xc], outFile);
                 }
                 else
-                    fputc(dp[x], outFile);
+                    fputc(dp[xc], outFile);
             }
             else
-                fputc(dp[x], outFile);
+                fputc(dp[xc], outFile);
         }
 
         fprintf(outFile, "\n");
@@ -603,15 +603,15 @@
 
 /* Print out location list as HTML option list.
  */
-void outputMapLocHTML(FILE *outFile, MapLocations *l)
+void outputMapLocHTML(FILE *outFile, MapLocations *lp)
 {
     assert(l != NULL);
 
     fprintf(outFile, "<option value=\"\">-</option>\n");
 
-    for (int i = 0; i < l->nlocations; i++)
+    for (int i = 0; i < lp->nlocations; i++)
     {
-        LocMarker *tmp = l->locations[i];
+        LocMarker *tmp = lp->locations[i];
 
         if (tmp->flags & LOCF_INVIS)
             continue;
@@ -632,7 +632,7 @@
 }
 
 
-void outputLocationFile(FILE *outFile, MapLocations *l)
+void outputLocationFile(FILE *outFile, MapLocations *lp)
 {
     // Output header
     fprintf(outFile,
@@ -646,9 +646,9 @@
     );
 
     // Output each location entry
-    for (int i = 0; i < l->nlocations; i++)
+    for (int i = 0; i < lp->nlocations; i++)
     {
-        LocMarker *tmp = l->locations[i];
+        LocMarker *tmp = lp->locations[i];
 
         // Add comment in few cases
         if (tmp->flags & LOCF_Q_MASK)
@@ -742,7 +742,7 @@
 /* Generate a shell-script for running ImageMagick to add
  * location and label information to an map image.
  */
-void outputMagickScript(FILE *outFile, MapLocations *l)
+void outputMagickScript(FILE *outFile, MapLocations *lp)
 {
     int numCity, numLoc, numTotal;
 
@@ -754,9 +754,9 @@
     numCity = numLoc = numTotal = 0;
 
     // Output instructions for each visible location
-    for (int i = 0; i < l->nlocations; i++)
+    for (int i = 0; i < lp->nlocations; i++)
     {
-        LocMarker *tmp = l->locations[i];
+        LocMarker *tmp = lp->locations[i];
         int xc, yc, leftMove;
         char *cs;
 
@@ -1000,16 +1000,16 @@
 }
 
 
-void outputGMapsXML(FILE *outFile, MapLocations *l)
+void outputGMapsXML(FILE *outFile, MapLocations *lp)
 {
     fprintf(outFile,
     "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
     "<markers>\n");
 
     // Output each location entry
-    for (int i = 0; i < l->nlocations; i++)
+    for (int i = 0; i < lp->nlocations; i++)
     {
-        LocMarker *tmp = l->locations[i];
+        LocMarker *tmp = lp->locations[i];
 
         // Skip disabled / invisible locations
         if (tmp->flags & (LOCF_INVIS | LOCF_INVALID)) continue;
@@ -1058,14 +1058,14 @@
 }
 
 
-void outputGMapsJSON(FILE *outFile, MapLocations *l)
+void outputGMapsJSON(FILE *outFile, MapLocations *lp)
 {
     fprintf(outFile, "[\n");
 
     // Output each location entry
-    for (int i = 0; i < l->nlocations; i++)
+    for (int i = 0; i < lp->nlocations; i++)
     {
-        LocMarker *tmp = l->locations[i];
+        LocMarker *tmp = lp->locations[i];
 
         // Skip disabled / invisible locations
         if (tmp->flags & (LOCF_INVIS | LOCF_INVALID)) continue;
@@ -1093,7 +1093,7 @@
         }
 
         fprintf(outFile, "}%s\n",
-            (i < l->nlocations - 1) ? "," : "");
+            (i < lp->nlocations - 1) ? "," : "");
     }
 
     fprintf(outFile, "]\n");