changeset 77:9b8da7c7219e

Misc. cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 26 Sep 2011 13:46:17 +0300
parents 042b44809e6e
children 626678d4ecf3
files src/yadex.cc src/yadex.h
diffstat 2 files changed, 18 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/yadex.cc	Mon Sep 26 13:45:30 2011 +0300
+++ b/src/yadex.cc	Mon Sep 26 13:46:17 2011 +0300
@@ -660,26 +660,29 @@
             printf("Please enter a command or ? for help.\n");
 
         /* user inputting for help */
-        else if (strcmp(com, "?") == 0
-                 || strcmp(com, "h") == 0 || strcmp(com, "help") == 0)
+        else if (!strcmp(com, "?") || !strcmp(com, "h") || !strcmp(com, "help"))
         {
             PrintHelp();
         }
 
         /* user asked for list of open wad files */
-        else if (strcmp(com, "wads") == 0 || strcmp(com, "w") == 0)
+        else if (!strcmp(com, "wads") || !strcmp(com, "w"))
         {
             const Wad_file *wf;
             wad_list.rewind();
+
             if (wad_list.get(wf))
                 printf("%-40s  Iwad\n", wf->pathname());
+
             while (wad_list.get(wf))
+            {
                 printf("%-40s  Pwad (%.*s)\n",
                        wf->pathname(), (int) WAD_NAME, wf->what());
+            }
         }
 
         /* user asked to quit */
-        else if (strcmp(com, "quit") == 0 || strcmp(com, "q") == 0)
+        else if (!strcmp(com, "quit") || !strcmp(com, "q"))
         {
             if (!Registered)
                 printf("Remember to register your copy of the game !\n");
@@ -687,31 +690,32 @@
         }
 
         /* user asked to edit a level */
-        else if (strcmp(com, "edit") == 0 || strcmp(com, "e") == 0
-                 || strcmp(com, "create") == 0 || strcmp(com, "c") == 0)
+        else if (!strcmp(com, "edit") || !strcmp(com, "e") ||
+                 !strcmp(com, "create") || !strcmp(com, "c"))
         {
-            const int newlevel = strcmp(com, "create") == 0
-                || strcmp(com, "c") == 0;
-            char *level_name = 0;
+            const bool newlevel = (com[0] == 'c');
+            char *level_name = NULL;
+
             com = strtok(NULL, " ");
-            if (com == 0)
+            if (com == NULL)
+            {
                 if (!newlevel)
                 {
                     printf("Which level ?\n");
                     continue;
                 }
-                else
-                    level_name = 0;
+            }
             else
             {
                 if (FindMasterDir(MasterDir, com))
                 {
-                    printf("Level %s not found.", com);
+                    printf("Level '%s' not found.", com);
                     // Hint absent-minded users
                     if ((tolower(*com) == 'e' && yg_level_name == YGLN_MAP01) ||
                         (tolower(*com) == 'm' && yg_level_name == YGLN_E1M1))
                         printf(" You are in %s mode.", Game);
-                    else if (tolower(*com) == 'e' && com[1] > '1' && !Registered)
+                    else
+                    if (tolower(*com) == 'e' && com[1] > '1' && !Registered)
                         printf(" You have the shareware iwad.");
                     putchar('\n');
                     continue;
--- a/src/yadex.h	Mon Sep 26 13:45:30 2011 +0300
+++ b/src/yadex.h	Mon Sep 26 13:46:17 2011 +0300
@@ -315,15 +315,6 @@
 #define IIV_CANCEL  INT_MIN
 
 
-/*
- *        Not real variables -- just a way for functions
- *        that return pointers to report errors in a better
- *        fashion than by just returning NULL and setting
- *        a global variable.
- */
-extern char error_non_unique[1];        // Found more than one
-extern char error_none[1];        // Found none
-extern char error_invalid[1];        // Invalid parameter
 
 
 /*