changeset 2606:5ee3c098dab9

Rename some variables.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 16 Feb 2024 11:54:30 +0200
parents 6b432b91916c
children f08dfd76b456
files src/mkloc.c
diffstat 1 files changed, 137 insertions(+), 138 deletions(-) [+]
line wrap: on
line diff
--- a/src/mkloc.c	Fri Feb 16 02:49:21 2024 +0200
+++ b/src/mkloc.c	Fri Feb 16 11:54:30 2024 +0200
@@ -289,34 +289,34 @@
     for (int i = 0; i < lp->nlocations; i++)
     {
         int yc, x0, x1, len;
-        LocMarker *tmp = lp->locations[i];
+        LocMarker *loc = lp->locations[i];
 
-        len = strlen(tmp->names[0].name);
+        len = strlen(loc->names[0].name);
         if (optLabelType)
-            len += locPrintType(NULL, tmp, true, NULL, false);
+            len += locPrintType(NULL, loc, true, NULL, false);
 
         // Compute text location
-        switch (tmp->align)
+        switch (loc->align)
         {
         case LOCD_LEFTDOWN:
-            yc = tmp->yc + 1;
-            x0 = tmp->xc - len;
+            yc = loc->yc + 1;
+            x0 = loc->xc - len;
             break;
 
         case LOCD_LEFT:
-            yc = tmp->yc - 1;
-            x0 = tmp->xc - len;
+            yc = loc->yc - 1;
+            x0 = loc->xc - len;
             break;
 
         case LOCD_DOWN:
-            yc = tmp->yc + 1;
-            x0 = tmp->xc + 1;
+            yc = loc->yc + 1;
+            x0 = loc->xc + 1;
             break;
 
         case LOCD_NONE:
         default:
-            yc = tmp->yc - 1;
-            x0 = tmp->xc + 1;
+            yc = loc->yc - 1;
+            x0 = loc->xc + 1;
             break;
         }
 
@@ -333,8 +333,8 @@
             yc -= (yc - map->height - 1);
 
         // Update location info
-        tmp->xc = x0;
-        tmp->yc = yc;
+        loc->xc = x0;
+        loc->yc = yc;
     }
 }
 
@@ -518,10 +518,10 @@
             int n;
             if ((n = locFindByCoords(lp, xc, yc, true)) >= 0)
             {
-                LocMarker *tmp = lp->locations[n];
+                LocMarker *loc = lp->locations[n];
                 char chm = dp[xc];
 
-                switch (tmp->flags & LOCF_M_MASK)
+                switch (loc->flags & LOCF_M_MASK)
                 {
                 case LOCF_M_SCENIC1: chm = '?'; break;
                 case LOCF_M_SCENIC2: chm = '%'; break;
@@ -529,13 +529,13 @@
                 case LOCF_M_CITY: chm = 'c'; break;
 
                 default:
-                    if (tmp->flags & LOCF_INVALID)
+                    if (loc->flags & LOCF_INVALID)
                         chm = '$';
                     break;
                 }
 
                 fputc(0xfb, outFile);
-                fprintf(outFile, "mloc%d_%d", tmp->ox + 1, tmp->oy + 1);
+                fprintf(outFile, "mloc%d_%d", loc->ox + 1, loc->oy + 1);
                 fputc(0xfc, outFile);
                 fputc(chm, outFile);
                 fputc(0xfe, outFile);
@@ -543,23 +543,23 @@
             else
             if (!optNoLabels && (n = locFindByCoords(lp, xc, yc, false)) >= 0)
             {
-                LocMarker *tmp = lp->locations[n];
+                LocMarker *loc = lp->locations[n];
 
-                if ((tmp->flags & LOCF_INVIS) == 0)
+                if ((loc->flags & LOCF_INVIS) == 0)
                 {
                     int col = col_light_white;
 
                     fputc(0xff, outFile);
-                    fprintf(outFile, "loc%d_%d", tmp->ox + 1, tmp->oy + 1);
+                    fprintf(outFile, "loc%d_%d", loc->ox + 1, loc->oy + 1);
                     fputc(0xfc, outFile);
 
-                    switch (tmp->flags & LOCF_M_MASK)
+                    switch (loc->flags & LOCF_M_MASK)
                     {
                     case LOCF_M_PCITY: col = col_light_green; break;
                     case LOCF_M_CITY: col = col_light_red; break;
 
                     default:
-                        switch (tmp->flags & LOCF_T_MASK)
+                        switch (loc->flags & LOCF_T_MASK)
                         {
                         case LOCF_T_SHRINE: col = col_light_yellow; break;
                         case LOCF_T_GUILD: col = col_light_magenta; break;
@@ -571,21 +571,21 @@
                         break;
                     }
 
-                    if (tmp->flags & LOCF_CLOSED)
+                    if (loc->flags & LOCF_CLOSED)
                         col = col_light_red;
 
                     fputc(col, outFile);
 
                     if (optLabelType)
                     {
-                        xc += locPrintType(outFile, tmp, !optNoAdjust, NULL, false);
+                        xc += locPrintType(outFile, loc, !optNoAdjust, NULL, false);
                     }
 
-                    fputs(tmp->names[0].name, outFile);
+                    fputs(loc->names[0].name, outFile);
                     fputc(0xfe, outFile);
 
                     if (!optNoAdjust)
-                        xc += strlen(tmp->names[0].name) - 1;
+                        xc += strlen(loc->names[0].name) - 1;
                     else
                         fputc(dp[xc], outFile);
                 }
@@ -605,19 +605,17 @@
  */
 void outputMapLocHTML(FILE *outFile, MapLocations *lp)
 {
-    assert(l != NULL);
-
     fprintf(outFile, "<option value=\"\">-</option>\n");
 
     for (int i = 0; i < lp->nlocations; i++)
     {
-        LocMarker *tmp = lp->locations[i];
+        LocMarker *loc = lp->locations[i];
 
-        if (tmp->flags & LOCF_INVIS)
+        if (loc->flags & LOCF_INVIS)
             continue;
 
-        fprintf(outFile, "<option value=\"loc%d_%d\">", tmp->ox + 1, tmp->oy + 1);
-        locPrintType(outFile, tmp, false, fputse, true);
+        fprintf(outFile, "<option value=\"loc%d_%d\">", loc->ox + 1, loc->oy + 1);
+        locPrintType(outFile, loc, false, fputse, true);
         fprintf(outFile, "</option>\n");
     }
 }
@@ -648,29 +646,29 @@
     // Output each location entry
     for (int i = 0; i < lp->nlocations; i++)
     {
-        LocMarker *tmp = lp->locations[i];
+        LocMarker *loc = lp->locations[i];
 
         // Add comment in few cases
-        if (tmp->flags & LOCF_Q_MASK)
+        if (loc->flags & LOCF_Q_MASK)
         {
             char *s = NULL;
-            if (tmp->flags & LOCF_NOMARKER)
+            if (loc->flags & LOCF_NOMARKER)
                 s = "Location missing marker";
             else
-            if (tmp->flags & LOCF_INVALID)
+            if (loc->flags & LOCF_INVALID)
                 s = "Possibly invalid location";
 
             if (s)
             {
                 fprintf(outFile, "\n# %s #%d: %s\n",
-                    s, i, tmp->names[0].name);
+                    s, i, loc->names[0].name);
             }
         }
 
         fprintf(outFile, "%d\t; %d\t; %d",
-            tmp->ox + 1, tmp->oy + 1, tmp->align);
+            loc->ox + 1, loc->oy + 1, loc->align);
 
-        switch (tmp->flags & LOCF_M_MASK)
+        switch (loc->flags & LOCF_M_MASK)
         {
         case LOCF_M_SCENIC1:    fputc('?', outFile); break;
         case LOCF_M_SCENIC2:    fputc('%', outFile); break;
@@ -678,7 +676,7 @@
         case LOCF_M_CITY:       fputc('c', outFile); break;
         }
 
-        switch (tmp->flags & LOCF_T_MASK)
+        switch (loc->flags & LOCF_T_MASK)
         {
         case LOCF_T_SHRINE:     fputc('S', outFile); break;
         case LOCF_T_GUILD:      fputc('G', outFile); break;
@@ -688,40 +686,40 @@
         case LOCF_T_FORT:       fputc('F', outFile); break;
         }
 
-        if (tmp->flags & LOCF_CLOSED)
+        if (loc->flags & LOCF_CLOSED)
             fputc('!', outFile);
 
-        if (tmp->flags & LOCF_INSTANCED)
+        if (loc->flags & LOCF_INSTANCED)
             fputc('I', outFile);
 
-        if (tmp->flags & LOCF_INVIS)
+        if (loc->flags & LOCF_INVIS)
             fputc('-', outFile);
 
         fprintf(outFile, "\t;");
-        printLocNameEsc(outFile, &tmp->names[0]);
-        for (int n = 1; n < tmp->nnames; n++)
+        printLocNameEsc(outFile, &loc->names[0]);
+        for (int n = 1; n < loc->nnames; n++)
         {
             fprintf(outFile, "|");
-            printLocNameEsc(outFile, &tmp->names[n]);
+            printLocNameEsc(outFile, &loc->names[n]);
         }
         fprintf(outFile, ";");
 
-        if (tmp->ncreators > 0)
+        if (loc->ncreators > 0)
         {
-            printLocNameEsc(outFile, &tmp->creators[0]);
-            for (int n = 1; n < tmp->ncreators; n++)
+            printLocNameEsc(outFile, &loc->creators[0]);
+            for (int n = 1; n < loc->ncreators; n++)
             {
                 fprintf(outFile, ",");
-                printLocNameEsc(outFile, &tmp->creators[n]);
+                printLocNameEsc(outFile, &loc->creators[n]);
             }
         }
 
         fprintf(outFile, ";");
 
-        if (tmp->valid)
+        if (loc->valid)
         {
             const char *acc;
-            switch (tmp->added.accuracy)
+            switch (loc->added.accuracy)
             {
                 case TS_ACC_DEFAULT: acc = ""; break;
                 case TS_ACC_KNOWN  : acc = "!"; break;
@@ -731,18 +729,18 @@
             }
 
             fprintf(outFile, "%s" LOC_TIMEFMT,
-                acc, tmp->added.day, tmp->added.month, tmp->added.year);
+                acc, loc->added.day, loc->added.month, loc->added.year);
         }
 
         fprintf(outFile, ";");
 
-        if (tmp->uri)
-            fputsesc2(tmp->uri, outFile);
+        if (loc->uri)
+            fputsesc2(loc->uri, outFile);
 
         fprintf(outFile, ";");
 
-        if (tmp->freeform)
-            fputsesc2(tmp->freeform, outFile);
+        if (loc->freeform)
+            fputsesc2(loc->freeform, outFile);
 
         fprintf(outFile, "\n");
     }
@@ -762,42 +760,42 @@
     // Output instructions for each visible location
     for (int i = 0; i < lp->nlocations; i++)
     {
-        LocMarker *tmp = lp->locations[i];
+        LocMarker *loc = lp->locations[i];
         int xc, yc, leftMove;
         char *cs;
 
         // Is location visible?
-        if (tmp->flags & LOCF_INVIS)
+        if (loc->flags & LOCF_INVIS)
             continue;
 
-        leftMove = ((float) strlen(tmp->names[0].name)) * optFontScale;
+        leftMove = ((float) strlen(loc->names[0].name)) * optFontScale;
 
-        switch (tmp->align)
+        switch (loc->align)
         {
         case LOCD_LEFTDOWN:
-            yc = tmp->yc + optUnitSize*3.0f;
-            xc = tmp->xc - leftMove;
+            yc = loc->yc + optUnitSize*3.0f;
+            xc = loc->xc - leftMove;
             break;
 
         case LOCD_LEFT:
-            yc = tmp->yc - optUnitSize;
-            xc = tmp->xc - leftMove;
+            yc = loc->yc - optUnitSize;
+            xc = loc->xc - leftMove;
             break;
 
         case LOCD_DOWN:
-            yc = tmp->yc + optUnitSize*3.0f;
-            xc = tmp->xc + optUnitSize;
+            yc = loc->yc + optUnitSize*3.0f;
+            xc = loc->xc + optUnitSize;
             break;
 
         case LOCD_NONE:
         default:
-            yc = tmp->yc - optUnitSize;
-            xc = tmp->xc + optUnitSize;
+            yc = loc->yc - optUnitSize;
+            xc = loc->xc + optUnitSize;
             break;
         }
 
         // Determine colour
-        switch (tmp->flags & LOCF_M_MASK)
+        switch (loc->flags & LOCF_M_MASK)
         {
         case LOCF_M_CITY:
             cs = "'#880000'";
@@ -806,7 +804,7 @@
             cs = "'#00ff00'";
             break;
         default:
-            switch (tmp->flags & LOCF_T_MASK)
+            switch (loc->flags & LOCF_T_MASK)
             {
                 case LOCF_T_SHRINE: cs = "yellow"; break;
                 case LOCF_T_GUILD: cs = "magenta"; break;
@@ -818,20 +816,20 @@
             break;
         }
 
-        if (tmp->flags & LOCF_CLOSED)
+        if (loc->flags & LOCF_CLOSED)
             cs = "'#ff0000'";
 
         // Location marker
         fprintf(outFile,
             "\t-fill black -draw \"circle %d,%d %d,%d\" ",
-            tmp->xc, tmp->yc,
-            (int) (tmp->xc + optUnitSize), (int) (tmp->yc + optUnitSize));
+            loc->xc, loc->yc,
+            (int) (loc->xc + optUnitSize), (int) (loc->yc + optUnitSize));
 
         fprintf(outFile,
             "-fill %s -draw \"circle %d,%d %d,%d\" ",
-            cs, tmp->xc, tmp->yc,
-            (int) (tmp->xc + optUnitSize * 0.90f),
-            (int) (tmp->yc + optUnitSize * 0.90f));
+            cs, loc->xc, loc->yc,
+            (int) (loc->xc + optUnitSize * 0.90f),
+            (int) (loc->yc + optUnitSize * 0.90f));
 
 
         // Location description text
@@ -841,7 +839,7 @@
                 "-fill %s -box '#00000080' -draw \"text %d,%d '",
                 cs, xc, yc);
 
-            fputsesc3(tmp->names[0].name, outFile);
+            fputsesc3(loc->names[0].name, outFile);
             fprintf(outFile, "'\" ");
         }
 
@@ -889,64 +887,65 @@
         return ptr;
 }
 
-void outputGMapsHTML(FILE *outFile, LocMarker *tmp,
-    int (*fpr)(FILE *, const char *fmt, ...), int (*fps)(const char *, FILE *))
+void outputGMapsHTML(FILE *outFile, LocMarker *loc,
+    int (*fpr)(FILE *, const char *fmt, ...),
+    int (*fps)(const char *, FILE *))
 {
-    if (tmp->uri != NULL)
+    if (loc->uri != NULL)
     {
-        fpr(outFile, "<b><a target=\"_blank\" href=\"%s\">", tmp->uri);
-        locPrintType(outFile, tmp, false, fps, true);
+        fpr(outFile, "<b><a target=\"_blank\" href=\"%s\">", loc->uri);
+        locPrintType(outFile, loc, false, fps, true);
         fpr(outFile, "</a></b><br>");
     }
     else
     {
         fpr(outFile, "<b>");
-        locPrintType(outFile, tmp, false, fps, true);
+        locPrintType(outFile, loc, false, fps, true);
         fpr(outFile, "</b><br>");
     }
 
     // Alternative names, if any
-    if (tmp->nnames > 1)
+    if (loc->nnames > 1)
     {
         fpr(outFile, "Also known as <i>");
-        for (int n = 1; n < tmp->nnames; n++)
+        for (int n = 1; n < loc->nnames; n++)
         {
-            fps(tmp->names[n].name, outFile);
-            if (tmp->names[n].flags & NAME_ORIG)
+            fps(loc->names[n].name, outFile);
+            if (loc->names[n].flags & NAME_ORIG)
                 fprintf(outFile, " (*)");
-            if (n < tmp->nnames - 1)
+            if (n < loc->nnames - 1)
                 fprintf(outFile, " ; ");
         }
         fpr(outFile, "</i>.<br>");
     }
 
     // Added to game timestamp
-    if (tmp->valid)
+    if (loc->valid)
     {
         fpr(outFile, "Added " LOC_TIMEFMT ".<br>",
-            tmp->added.day, tmp->added.month, tmp->added.year);
+            loc->added.day, loc->added.month, loc->added.year);
     }
 
     // Creator names or societies
-    if (tmp->ncreators > 0)
+    if (loc->ncreators > 0)
     {
-        if (tmp->flags & LOCF_M_PCITY)
+        if (loc->flags & LOCF_M_PCITY)
         {
             fprintf(outFile, "Societies: ");
-            for (int n = 0; n < tmp->ncreators; n++)
+            for (int n = 0; n < loc->ncreators; n++)
             {
-                fps(tmp->creators[n].name, outFile);
-                if (n < tmp->ncreators - 1)
+                fps(loc->creators[n].name, outFile);
+                if (n < loc->ncreators - 1)
                     fprintf(outFile, ", ");
             }
         }
         else
         {
             fprintf(outFile, "Creators: ");
-            for (int n = 0; n < tmp->ncreators; n++)
+            for (int n = 0; n < loc->ncreators; n++)
             {
                 char *info = "", *sinfo = "";
-                switch (tmp->creators[n].flags)
+                switch (loc->creators[n].flags)
                 {
                     case CREATOR_ORIG: info = " (O)"; sinfo = "Original coder"; break;
                     case CREATOR_RECODER: info = " (R)"; sinfo = "Re-coder"; break;
@@ -955,10 +954,10 @@
                 }
                 //fpr(outFile, "<a target=\"_blank\" href=\"http://www.bat.org/char/%s\">%s%s</a>",
                 fpr(outFile, "<a target=\"_blank\" href=\"https://tnsp.org/maps/loc.php?a=%s\" title=\"%s\">%s%s</a>",
-                    tmp->creators[n].name, sinfo,
-                    tmp->creators[n].name, info);
+                    loc->creators[n].name, sinfo,
+                    loc->creators[n].name, info);
 
-                if (n < tmp->ncreators - 1)
+                if (n < loc->ncreators - 1)
                     fprintf(outFile, ", ");
             }
         }
@@ -966,9 +965,9 @@
     }
 
     // Print out freeform information field
-    if (tmp->freeform)
+    if (loc->freeform)
     {
-        char *ptr = tmp->freeform;
+        char *ptr = loc->freeform;
         char *buf = NULL;
         size_t bufLen = 0, bufSize = 0;
 
@@ -1010,46 +1009,46 @@
     // Output each location entry
     for (int i = 0; i < lp->nlocations; i++)
     {
-        LocMarker *tmp = lp->locations[i];
+        LocMarker *loc = lp->locations[i];
 
         // Skip disabled / invisible locations
-        if (tmp->flags & (LOCF_INVIS | LOCF_INVALID)) continue;
+        if (loc->flags & (LOCF_INVIS | LOCF_INVALID)) continue;
 
         // Coordinates and label direction/alignment
         fprintf(outFile, "<marker x=\"%d\" y=\"%d\" labeldir=\"%d\"",
-            tmp->ox, tmp->oy, tmp->align);
+            loc->ox, loc->oy, loc->align);
 
         // Primary location name
         fprintf(outFile, " name=\"");
-        locPrintType(outFile, tmp, false, fputse, false);
+        locPrintType(outFile, loc, false, fputse, false);
         fprintf(outFile, "\"");
 
         // HTML
         fprintf(outFile, " html=\"");
-        outputGMapsHTML(outFile, tmp, fprintfe, fputse);
+        outputGMapsHTML(outFile, loc, fprintfe, fputse);
         fprintf(outFile, "\"");
 
         // Flags
         fprintf(outFile, " flags=\"%d\"",
-            tmp->flags);
+            loc->flags);
 
         // Continent name
-        if (tmp->file != NULL && tmp->file->continent != NULL)
+        if (loc->file != NULL && loc->file->continent != NULL)
         {
             fprintf(outFile, " continent=\"");
-            fputse(tmp->file->continent, outFile);
+            fputse(loc->file->continent, outFile);
             fprintf(outFile, "\"");
         }
 
         // Type of the marker
         fprintf(outFile, " type=\"%s\"",
-            locGetTypeName(tmp->flags));
+            locGetTypeName(loc->flags));
 
         // Added to game timestamp
-        if (tmp->valid)
+        if (loc->valid)
         {
             const char *acc;
-            switch (tmp->added.accuracy)
+            switch (loc->added.accuracy)
             {
                 case TS_ACC_DEFAULT: acc = "default"; break;
                 case TS_ACC_KNOWN  : acc = "known"; break;
@@ -1060,39 +1059,39 @@
 
             fprintf(outFile,
                 " added=\"" LOC_TIMEFMT "\" added-accuracy=\"%s\"",
-                tmp->added.day, tmp->added.month, tmp->added.year,
+                loc->added.day, loc->added.month, loc->added.year,
                 acc);
         }
 
         fprintf(outFile, ">");
 
         // Location alternative names
-        if (tmp->nnames > 1)
+        if (loc->nnames > 1)
         {
             fprintf(outFile, "<altnames>");
-            for (int n = 1; n < tmp->nnames; n++)
+            for (int n = 1; n < loc->nnames; n++)
             {
-                const char *tmps = locGetAreaNameType(tmp->names[n].flags, true);
+                const char *tmps = locGetAreaNameType(loc->names[n].flags, true);
                 fprintf(outFile, "<name");
                 if (tmps != NULL)
                     fprintf(outFile, " type=\"original\"");
                 fprintf(outFile, ">");
-                fputse(tmp->names[n].name, outFile);
+                fputse(loc->names[n].name, outFile);
                 fprintf(outFile, "</name>");
             }
             fprintf(outFile, "</altnames>");
         }
 
         // Creators or secret societies
-        if (tmp->ncreators > 0)
+        if (loc->ncreators > 0)
         {
-            if (tmp->flags & LOCF_M_PCITY)
+            if (loc->flags & LOCF_M_PCITY)
             {
                 fprintf(outFile, "<societies>");
-                for (int n = 0; n < tmp->ncreators; n++)
+                for (int n = 0; n < loc->ncreators; n++)
                 {
                     fprintf(outFile, "<name>");
-                    fputse(tmp->creators[n].name, outFile);
+                    fputse(loc->creators[n].name, outFile);
                     fprintf(outFile, "</name>");
                 }
                 fprintf(outFile, "</societies>");
@@ -1100,11 +1099,11 @@
             else
             {
                 fprintf(outFile, "<creators>");
-                for (int n = 0; n < tmp->ncreators; n++)
+                for (int n = 0; n < loc->ncreators; n++)
                 {
                     fprintf(outFile, "<creator role=\"%s\">",
-                        locGetAreaCreatorRole(tmp->creators[n].flags, true));
-                    fputse(tmp->creators[n].name, outFile);
+                        locGetAreaCreatorRole(loc->creators[n].flags, true));
+                    fputse(loc->creators[n].name, outFile);
                     fprintf(outFile, "</creator>");
                 }
                 fprintf(outFile, "</creators>");
@@ -1125,30 +1124,30 @@
     // Output each location entry
     for (int i = 0; i < lp->nlocations; i++)
     {
-        LocMarker *tmp = lp->locations[i];
+        LocMarker *loc = lp->locations[i];
 
         // Skip disabled / invisible locations
-        if (tmp->flags & (LOCF_INVIS | LOCF_INVALID)) continue;
+        if (loc->flags & (LOCF_INVIS | LOCF_INVALID)) continue;
 
         // Print out coordinates etc.
         fprintf(outFile, "{\"x\":%d,\"y\":%d,\"labeldir\":%d,\"name\":\"",
-            tmp->ox, tmp->oy, tmp->align);
+            loc->ox, loc->oy, loc->align);
 
         // Location name
-        locPrintType(outFile, tmp, false, fputsesc1, false);
+        locPrintType(outFile, loc, false, fputsesc1, false);
         fprintf(outFile, "\",\"html\":\"");
 
-        outputGMapsHTML(outFile, tmp, fprintfesc1, fputsesc1);
+        outputGMapsHTML(outFile, loc, fprintfesc1, fputsesc1);
 
         // Flags
         fprintf(outFile, "\",\"flags\":%d",
-            tmp->flags);
+            loc->flags);
 
         // Continent name
-        if (tmp->file != NULL && tmp->file->continent != NULL)
+        if (loc->file != NULL && loc->file->continent != NULL)
         {
             fprintf(outFile, ",\"continent\":\"");
-            fputsesc1(tmp->file->continent, outFile);
+            fputsesc1(loc->file->continent, outFile);
             fprintf(outFile, "\"");
         }
 
@@ -1273,10 +1272,10 @@
 
         for (int i = 0; i < worldLoc.nlocations; i++)
         {
-            LocMarker *tmp = worldLoc.locations[i];
+            LocMarker *loc = worldLoc.locations[i];
 
-            tmp->xc = ((float) tmp->xc) * optScale;
-            tmp->yc = ((float) tmp->yc) * optScale;
+            loc->xc = ((float) loc->xc) * optScale;
+            loc->yc = ((float) loc->yc) * optScale;
         }
     }