Entirely eliminate wd1x and wd2x members of the command block.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 3 Jul 2017 20:49:33 +0000 (16:49 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 3 Jul 2017 20:49:33 +0000 (16:49 -0400)
In the process, fix another case-smashing bug.

actions.c
advent.h
tests/illformed.chk

index fdf2319023732c79b8ea27b75d42b88468351619..b079bd352f863da9e3dab42a30da543b34efa5a9 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <stdbool.h>
+#include <string.h>
 #include "advent.h"
 #include "dungeon.h"
 
@@ -1037,11 +1038,11 @@ static int rub(token_t verb, token_t obj)
 static int say(struct command_t *command)
 /* Say.  Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).)  Magic words override. */
 {
-    long a = command->wd1, b = command->wd1x;
+    long a = command->wd1;
     if (command->wd2 > 0) {
         a = command->wd2;
-        b = command->wd2x;
         command->wd1 = command->wd2;
+       strcpy(command->raw1, command->raw2);
     }
     char word1[TOKLEN+1];
     packed_to_token(command->wd1, word1);
@@ -1056,7 +1057,7 @@ static int say(struct command_t *command)
         wordclear(&command->wd2);
         return GO_LOOKUP;
     }
-    rspeak(OKEY_DOKEY, a, b);
+    sspeak(OKEY_DOKEY, command->raw1);
     return GO_CLEAROBJ;
 }
 
index 560b15010854fa7f5d389c78b8177da8f8ccba32..61d3e4e42957708191ca6fe8a44445554bafec64 100644 (file)
--- a/advent.h
+++ b/advent.h
@@ -181,8 +181,8 @@ struct command_t {
     enum speechpart part;
     vocab_t verb;
     vocab_t obj;
-    token_t wd1, wd1x;
-    token_t wd2, wd2x;
+    token_t wd1;
+    token_t wd2;
     char raw1[BUFSIZ], raw2[BUFSIZ];
 };
 
index d682a61aa623bccda8dcb8b3f9d4c68050a737ae..77e098fdec292a8143f015ae3adf81d2d111bf87 100644 (file)
@@ -564,7 +564,7 @@ Though you flap your arms furiously, it is to no avail.
 
 > say boo
 
-Okay, "BOO".
+Okay, "boo".
 
 > score