changeset 104:76ad709ed3c6

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Oct 2014 05:04:24 +0300
parents 4ef9dfbd82b6
children b738873f9ef2
files src/editobj.cc src/entry.cc src/game.cc src/r_images.cc
diffstat 4 files changed, 15 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/editobj.cc	Mon Oct 06 04:02:47 2014 +0300
+++ b/src/editobj.cc	Mon Oct 06 05:04:24 2014 +0300
@@ -239,7 +239,6 @@
     DrawScreenText(text_x0, text_y0 + 5 * FONTH, "End vertex");
 
     first = 1;
-    key = 0;
     for (;;)
     {
         DrawScreenBoxHollow(entry1_x0, entry1_y0,
--- a/src/entry.cc	Mon Oct 06 04:02:47 2014 +0300
+++ b/src/entry.cc	Mon Oct 06 05:04:24 2014 +0300
@@ -165,8 +165,7 @@
                    char *filename)
 {
     int key;
-    size_t l;
-    size_t boxlen;
+    size_t boxlen, l;
     bool firstkey;
     int width;
     int title_y0;
@@ -181,16 +180,12 @@
 
     for (l = strlen(filename) + 1; l <= maxlen; l++)
         filename[l] = '\0';
+
     /* compute the width of the input box */
     if (maxlen > 20)
         boxlen = 20;
     else
         boxlen = maxlen;
-    /* compute the width of the dialog box */
-    if (strlen(prompt) > boxlen)
-        l = strlen(prompt);
-    else
-        l = boxlen;
 
     width = 2 * HOLLOW_BORDER + 2 * NARROW_HSPACING + boxlen * FONTW;
     if ((int) (strlen(prompt) * FONTW) > width)
--- a/src/game.cc	Mon Oct 06 04:02:47 2014 +0300
+++ b/src/game.cc	Mon Oct 06 05:04:24 2014 +0300
@@ -326,9 +326,9 @@
         }
         else
         {
-            free(buf);
             fatal_error("%s(%d): unknown directive \"%.32s\"",
                         filename, lineno, token[0]);
+            free(buf);
         }
     }
 
--- a/src/r_images.cc	Mon Oct 06 04:02:47 2014 +0300
+++ b/src/r_images.cc	Mon Oct 06 05:04:24 2014 +0300
@@ -117,7 +117,7 @@
     strncpy(name, texname, WAD_TEX_NAME);
     name[WAD_TEX_NAME] = 0;
 
-// Iwad-dependant details
+    // Iwad-dependant details
     if (yg_texture_format == YGTF_NAMELESS)
     {
         have_dummy_bytes = true;
@@ -142,9 +142,9 @@
         return 0;
     }
 
-/* offset for texture we want. */
+    /* offset for texture we want. */
     texofs = 0;
-// Doom alpha 0.4 : "TEXTURES", no names
+    // Doom alpha 0.4 : "TEXTURES", no names
     if (yg_texture_lumps == YGTL_TEXTURES
         && yg_texture_format == YGTF_NAMELESS)
     {
@@ -171,7 +171,7 @@
             }
         }
     }
-// Doom alpha 0.5 : only "TEXTURES"
+    // Doom alpha 0.5 : only "TEXTURES"
     else if (yg_texture_lumps == YGTL_TEXTURES
              && (yg_texture_format == YGTF_NORMAL
                  || yg_texture_format == YGTF_STRIFE11))
@@ -195,7 +195,7 @@
             FreeMemory(offsets);
         }
     }
-// Other iwads : "TEXTURE1" and "TEXTURE2"
+    // Other iwads : "TEXTURE1" and "TEXTURE2"
     else if (yg_texture_lumps == YGTL_NORMAL
              && (yg_texture_format == YGTF_NORMAL
                  || yg_texture_format == YGTF_STRIFE11))
@@ -243,16 +243,17 @@
     else
         nf_bug("Invalid texture_format/texture_lumps combination.");
 
-/* texture name not found */
+    /* texture name not found */
     if (texofs == 0)
         return 0;
 
-/* read the info for this texture */
+    /* read the info for this texture */
     i32 header_ofs;
     if (yg_texture_format == YGTF_NAMELESS)
         header_ofs = texofs;
     else
         header_ofs = texofs + WAD_TEX_NAME;
+
     dir->wadfile->seek(header_ofs + 4);
     dir->wadfile->read_i16(&width);
     dir->wadfile->read_i16(&height);
@@ -264,11 +265,10 @@
     }
     dir->wadfile->read_i16(&npatches);
 
-/* Compose the texture */
+    /* Compose the texture */
     Img *texbuf = new Img(width, height, false);
 
-/* Paste onto the buffer all the patches that the texture is
-   made of. */
+    /* Paste onto the buffer all the patches that the texture is made of. */
     for (n = 0; n < npatches; n++)
     {
         i16 xofs, yofs;                // offset in texture space for the patch
@@ -311,8 +311,10 @@
         }
 
         if (LoadPicture(*texbuf, picname, loc, xofs, yofs, 0, 0))
+        {
             warn("texture \"%.*s\": patch \"%.*s\" not found.\n",
                  WAD_TEX_NAME, tname, WAD_PIC_NAME, picname);
+        }
     }
 
     return texbuf;