Entirely eliminate wd1x and wd2x members of the command block.

In the process, fix another case-smashing bug.
This commit is contained in:
Eric S. Raymond 2017-07-03 16:49:33 -04:00
parent f52a78a1f8
commit 393010ec41
3 changed files with 7 additions and 6 deletions

View file

@ -1,5 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h>
#include "advent.h" #include "advent.h"
#include "dungeon.h" #include "dungeon.h"
@ -1037,11 +1038,11 @@ static int rub(token_t verb, token_t obj)
static int say(struct command_t *command) static int say(struct command_t *command)
/* Say. Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).) Magic words override. */ /* 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) { if (command->wd2 > 0) {
a = command->wd2; a = command->wd2;
b = command->wd2x;
command->wd1 = command->wd2; command->wd1 = command->wd2;
strcpy(command->raw1, command->raw2);
} }
char word1[TOKLEN+1]; char word1[TOKLEN+1];
packed_to_token(command->wd1, word1); packed_to_token(command->wd1, word1);
@ -1056,7 +1057,7 @@ static int say(struct command_t *command)
wordclear(&command->wd2); wordclear(&command->wd2);
return GO_LOOKUP; return GO_LOOKUP;
} }
rspeak(OKEY_DOKEY, a, b); sspeak(OKEY_DOKEY, command->raw1);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }

View file

@ -181,8 +181,8 @@ struct command_t {
enum speechpart part; enum speechpart part;
vocab_t verb; vocab_t verb;
vocab_t obj; vocab_t obj;
token_t wd1, wd1x; token_t wd1;
token_t wd2, wd2x; token_t wd2;
char raw1[BUFSIZ], raw2[BUFSIZ]; char raw1[BUFSIZ], raw2[BUFSIZ];
}; };

View file

@ -564,7 +564,7 @@ Though you flap your arms furiously, it is to no avail.
> say boo > say boo
Okay, "BOO". Okay, "boo".
> score > score