X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=blobdiff_plain;f=misc.c;h=ae5048d9a92825b948f770c4b218f9f83559abc8;hp=756e5cbfb223a443d3909fe4d3025b199bc3cb55;hb=08c40bc9993ce5684077b9ceac492e4fb642a722;hpb=03b2f1c86e4a7e856fadff2244b9c6456ccd8835 diff --git a/misc.c b/misc.c index 756e5cb..ae5048d 100644 --- a/misc.c +++ b/misc.c @@ -128,11 +128,6 @@ void tokenize(char* raw, struct command_t *cmd) /* Hide the fact that wods are corrently packed longs */ -bool wordempty(token_t a) -{ - return a == 0; -} - void wordclear(token_t *v) { *v = 0; @@ -140,7 +135,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) @@ -467,7 +462,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); @@ -482,7 +477,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); } } @@ -495,7 +490,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); @@ -510,7 +505,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); } }