X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=misc.c;h=340aa3de906dd860764a0934769ff011c519be28;hb=2fa530340d65c636fb297aee5df5805393f08d31;hp=c4dc35124b4e9885007e4110f85cad7d7163125e;hpb=d1e29319fa20a0d3e9924764f83a8cf2020e84da;p=open-adventure.git diff --git a/misc.c b/misc.c index c4dc351..340aa3d 100644 --- a/misc.c +++ b/misc.c @@ -99,10 +99,6 @@ void tokenize(char* raw, struct command_t *cmd) * raw-input buffer as long as the enrire inout buffer. */ sscanf(raw, "%s%s", cmd->raw1, cmd->raw2); - // pack the substrings - cmd->wd1 = token_to_packed(cmd->raw1); - cmd->wd2 = token_to_packed(cmd->raw2); - /* (ESR) In oldstyle mode, simulate the uppercasing and truncating * effect on raw tokens of packing them into sixbit characters, 5 * to a 32-bit word. This is something the FORTRAN version did @@ -135,7 +131,7 @@ void wordclear(token_t *v) /* I/O routines (speak, pspeak, rspeak, sspeak, get_input, yes) */ -void vspeak(const char* msg, bool blank, va_list ap) +static void vspeak(const char* msg, bool blank, va_list ap) { // Do nothing if we got a null pointer. if (msg == NULL) @@ -462,7 +458,7 @@ int get_motion_vocab_id(const char* word) { for (int i = 0; i < NMOTIONS; ++i) { for (int j = 0; j < motions[i].words.n; ++j) { - if (strcasecmp(word, motions[i].words.strs[j]) == 0 && (strlen(word) > 1 || + if (strncasecmp(word, motions[i].words.strs[j], TOKLEN) == 0 && (strlen(word) > 1 || strchr(ignore, word[0]) == NULL || !settings.oldstyle)) return (i); @@ -477,7 +473,7 @@ int get_object_vocab_id(const char* word) { for (int i = 0; i < NOBJECTS + 1; ++i) { // FIXME: the + 1 should go when 1-indexing for objects is removed for (int j = 0; j < objects[i].words.n; ++j) { - if (strcasecmp(word, objects[i].words.strs[j]) == 0) + if (strncasecmp(word, objects[i].words.strs[j], TOKLEN) == 0) return (i); } } @@ -490,7 +486,7 @@ int get_action_vocab_id(const char* word) { for (int i = 0; i < NACTIONS; ++i) { for (int j = 0; j < actions[i].words.n; ++j) { - if (strcasecmp(word, actions[i].words.strs[j]) == 0 && (strlen(word) > 1 || + if (strncasecmp(word, actions[i].words.strs[j], TOKLEN) == 0 && (strlen(word) > 1 || strchr(ignore, word[0]) == NULL || !settings.oldstyle)) return (i); @@ -505,7 +501,7 @@ int get_special_vocab_id(const char* word) { for (int i = 0; i < NSPECIALS; ++i) { for (int j = 0; j < specials[i].words.n; ++j) { - if (strcasecmp(word, specials[i].words.strs[j]) == 0) + if (strncasecmp(word, specials[i].words.strs[j], TOKLEN) == 0) return (i); } }