Fix bug that made YES() case-sensitive.
[open-adventure.git] / misc.c
diff --git a/misc.c b/misc.c
index aa4286bc570f6e29e40c06cb7fa620e9ee265674..fc7ac5f9a8af44059eefb5e73b803d7973c37c0d 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -271,10 +271,12 @@ bool YES(vocab_t question, vocab_t yes_response, vocab_t no_response)
        for (int i = 0; i < strlen(firstword); ++i)
            firstword[i] = tolower(firstword[i]);
        
-       int yes = strncmp("yes", reply, sizeof("yes") - 1);
-       int y = strncmp("y", reply, sizeof("y") - 1);
-       int no = strncmp("no", reply, sizeof("no") - 1);
-       int n = strncmp("n", reply, sizeof("n") - 1);
+       int yes = strncmp("yes", firstword, sizeof("yes") - 1);
+       int y = strncmp("y", firstword, sizeof("y") - 1);
+       int no = strncmp("no", firstword, sizeof("no") - 1);
+       int n = strncmp("n", firstword, sizeof("n") - 1);
+
+       free(firstword);
        
        if (yes == 0 || y == 0) {
            RSPEAK(yes_response);