changeset 48:42dfed6e6efb

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 25 Sep 2011 03:54:27 +0300
parents 0e4e73553cd7
children cf5f6ef9b713
files src/l_align.cc
diffstat 1 files changed, 33 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/src/l_align.cc	Sat Sep 24 23:14:25 2011 +0300
+++ b/src/l_align.cc	Sun Sep 25 03:54:27 2011 +0300
@@ -48,7 +48,7 @@
     int l, sector;
     int otherside = OBJ_NO_NONE;
 
-/* find the sidedef on the other side of the LineDef, if any */
+    /* find the sidedef on the other side of the LineDef, if any */
     for (l = 0; l < NumLineDefs; l++)
     {
         if (LineDefs[l].sidedef1 == sidedef)
@@ -62,10 +62,12 @@
             break;
         }
     }
-/* get the Sector number */
+
+    /* get the Sector number */
     sector = SideDefs[sidedef].sector;
-/* if the upper texture is displayed,
-   then the reference is taken from the other Sector */
+
+    /* if the upper texture is displayed, then the reference
+     * is taken from the other Sector */
     if (otherside >= 0)
     {
         l = SideDefs[otherside].sector;
@@ -76,7 +78,8 @@
                 sector = l;
         }
     }
-/* return the altitude of the ceiling */
+
+    /* return the altitude of the ceiling */
     if (sector >= 0)
         return Sectors[sector].ceilh;        /* textures are drawn from the ceiling down */
     else
@@ -104,12 +107,12 @@
     if (!*sdlist)
         return;
 
-/* get the reference height from the first sidedef */
+    /* get the reference height from the first sidedef */
     refh = GetTextureRefHeight((*sdlist)->objnum);
     SideDefs[(*sdlist)->objnum].yoff = 0;
     UnSelectObject(sdlist, (*sdlist)->objnum);
 
-/* adjust Y offset in all other SideDefs */
+    /* adjust Y offset in all other SideDefs */
     while (*sdlist)
     {
         h = GetTextureRefHeight((*sdlist)->objnum);
@@ -144,25 +147,25 @@
 {
     /* FIRST texture name used in the highlited objects */
     char texname[WAD_TEX_NAME + 1];
-    char errormessage[80];        /* area to hold the error messages produced */
+    char errormessage[128];          /* area to hold the error messages produced */
     int ldef;                        /* linedef number */
-    int sd1;                        /* current sidedef in *sdlist */
+    int sd1;                         /* current sidedef in *sdlist */
     int vert1, vert2;                /* vertex 1 and 2 for the linedef under scrutiny */
-    int xoffset;                /* xoffset accumulator */
-    int useroffset;                /* user input offset for first input */
-    i16 texlength;                /* the length of texture to format to */
-    int length;                        /* length of linedef under scrutiny */
-    i16 dummy;                        /* holds useless data */
-    int type_off;                /* do we have an initial offset to use */
-    int type_tex;                /* do we check for same textures */
-    int type_sd;                /* do we align sidedef 1 or sidedef 2 */
+    int xoffset;                     /* xoffset accumulator */
+    int useroffset;                  /* user input offset for first input */
+    i16 texlength;                   /* the length of texture to format to */
+    int length;                      /* length of linedef under scrutiny */
+    i16 dummy;                       /* holds useless data */
+    int type_off;                    /* do we have an initial offset to use */
+    int type_tex;                    /* do we check for same textures */
+    int type_sd;                     /* do we align sidedef 1 or sidedef 2 */
 
-    type_sd = 0;                /* which sidedef to align, 1=SideDef1, 2=SideDef2 */
-    type_tex = 0;                /* do we test for similar textures, 0 = no, 1 = yes */
-    type_off = 0;                /* do we have an inital offset, 0 = no, 1 = yes */
+    type_sd = 0;                     /* which sidedef to align, 1=SideDef1, 2=SideDef2 */
+    type_tex = 0;                    /* do we test for similar textures, 0 = no, 1 = yes */
+    type_off = 0;                    /* do we have an inital offset, 0 = no, 1 = yes */
 
     vert1 = -1;
-    vert2 = -1;                        /* 1st time round the while loop the -1 value is needed */
+    vert2 = -1;                      /* 1st time round the while loop the -1 value is needed */
     texlength = 0;
     xoffset = 0;
     useroffset = 0;
@@ -170,19 +173,19 @@
     switch (vDisplayMenu(250, 110, "Aligning textures (X offset) :",
                          " Sidedef 1, Check for identical textures.     ",
                          YK_, 0,
-                         " Sidedef 1, As above, but with inital offset. ",
+                         " Sidedef 1, As above, but with initial offset.",
                          YK_, 0,
                          " Sidedef 1, No texture checking.              ",
                          YK_, 0,
-                         " Sidedef 1, As above, but with inital offset. ",
+                         " Sidedef 1, As above, but with initial offset.",
                          YK_, 0,
                          " Sidedef 2, Check for identical textures.     ",
                          YK_, 0,
-                         " Sidedef 2, As above, but with inital offset. ",
+                         " Sidedef 2, As above, but with initial offset.",
                          YK_, 0,
                          " Sidedef 2, No texture checking.              ",
                          YK_, 0,
-                         " Sidedef 2, As above, but with inital offset. ",
+                         " Sidedef 2, As above, but with initial offset.",
                          YK_, 0, NULL))
     {
     case 1:                        /* Sidedef 1 with checking for same textures   */
@@ -275,11 +278,11 @@
         }
     }
 
-/* get texture name of the sidedef in the *sdlist) */
+    /* get texture name of the sidedef in the *sdlist) */
     strncpy(texname, SideDefs[(*sdlist)->objnum].tex3, WAD_TEX_NAME);
 
-/* test if there is a texture there */
-    if (texname[0] == '-')
+    /* test if there is a texture there */
+    if (texname[0] == 0 || texname[0] == '-')
     {
         Beep();
         sprintf(errormessage, "No texture for sidedef #%d.",
@@ -290,7 +293,7 @@
 
     GetWallTextureSize(&texlength, &dummy, texname);        /* clunky, but it works */
 
-/* get initial offset to use (if required) */
+    /* get initial offset to use (if required) */
     if (type_off == 1)                /* source taken from InputObjectNumber */
     {
         int x0;                        /* left hand (x) window start     */
@@ -417,5 +420,6 @@
         /* move to next object in selected list */
         UnSelectObject(sdlist, (*sdlist)->objnum);
     }
+
     MadeChanges = 1;
 }