Upgrade get_vocab_id() to handle empty strings.
This commit is contained in:
parent
659f797d8a
commit
07e7b8131e
2 changed files with 5 additions and 0 deletions
1
advent.h
1
advent.h
|
@ -20,6 +20,7 @@
|
||||||
#define PANICTIME 15 // time left after closing
|
#define PANICTIME 15 // time left after closing
|
||||||
#define BATTERYLIFE 2500 // turn limit increment from batteries
|
#define BATTERYLIFE 2500 // turn limit increment from batteries
|
||||||
#define WORD_NOT_FOUND -1 // "Word not found" flag value for the vocab hash functions.
|
#define WORD_NOT_FOUND -1 // "Word not found" flag value for the vocab hash functions.
|
||||||
|
#define WORD_EMPTY 0 // "Word empty" flag value for the vocab hash functions
|
||||||
#define CARRIED -1 // Player is toting it
|
#define CARRIED -1 // Player is toting it
|
||||||
#define READ_MODE "rb" // b is not needed for POSIX but harmless
|
#define READ_MODE "rb" // b is not needed for POSIX but harmless
|
||||||
#define WRITE_MODE "wb" // b is not needed for POSIX but harmless
|
#define WRITE_MODE "wb" // b is not needed for POSIX but harmless
|
||||||
|
|
4
misc.c
4
misc.c
|
@ -483,6 +483,10 @@ int get_special_vocab_id(const char* word)
|
||||||
long get_vocab_id(const char* word)
|
long get_vocab_id(const char* word)
|
||||||
// Search the vocab categories in order for the supplied word.
|
// Search the vocab categories in order for the supplied word.
|
||||||
{
|
{
|
||||||
|
/* Check for an empty string */
|
||||||
|
if (strncmp(word, "", sizeof("")) == 0)
|
||||||
|
return (WORD_EMPTY);
|
||||||
|
|
||||||
long ref_num;
|
long ref_num;
|
||||||
|
|
||||||
/* FIXME: Magic numbers related to vocabulary */
|
/* FIXME: Magic numbers related to vocabulary */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue