Upgrade get_vocab_id() to handle empty strings.
[open-adventure.git] / misc.c
diff --git a/misc.c b/misc.c
index 0b00992b6e0b1b2342a93258aa7a4db680bcbf41..6e3656f50fd90e9144e9f27177fc9a10673391ad 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -190,20 +190,6 @@ void vspeak(const char* msg, bool blank, va_list ap)
                 size -= len;
             }
 
-            // All-lowercase specifier.
-            if (msg[i] == 'L' ||
-                msg[i] == 'C') {
-                packed_to_token(arg, renderp); /* unpack directly to destination */
-                int len = strlen(renderp);
-                for (int j = 0; j < len; ++j) {
-                    renderp[j] = tolower(renderp[j]);
-                }
-                if (msg[i] == 'C') // First char uppercase, rest lowercase.
-                    renderp[0] = toupper(renderp[0]);
-                renderp += len;
-                size -= len;
-            }
-
             previous_arg = arg;
         }
     }
@@ -497,6 +483,10 @@ int get_special_vocab_id(const char* word)
 long get_vocab_id(const char* word)
 // Search the vocab categories in order for the supplied word.
 {
+    /* Check for an empty string */
+    if (strncmp(word, "", sizeof("")) == 0)
+      return (WORD_EMPTY);
+
     long ref_num;
 
     /* FIXME: Magic numbers related to vocabulary */