projects
/
open-adventure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
659f797
)
Upgrade get_vocab_id() to handle empty strings.
author
Jason S. Ninneman
<jsn@mbar.us>
Mon, 3 Jul 2017 17:37:44 +0000
(10:37 -0700)
committer
Jason S. Ninneman
<jsn@mbar.us>
Tue, 4 Jul 2017 01:08:04 +0000
(18:08 -0700)
advent.h
patch
|
blob
|
history
misc.c
patch
|
blob
|
history
diff --git
a/advent.h
b/advent.h
index 71b281ef8460f4e93d4038b89cccbf4226f1e0df..72af32f58592371f62727ad96584e7fea9d307f9 100644
(file)
--- a/
advent.h
+++ b/
advent.h
@@
-20,6
+20,7
@@
#define PANICTIME 15 // time left after closing
#define BATTERYLIFE 2500 // turn limit increment from batteries
#define WORD_NOT_FOUND -1 // "Word not found" flag value for the vocab hash functions.
#define PANICTIME 15 // time left after closing
#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_EMPTY 0 // "Word empty" flag value for the vocab hash functions
#define CARRIED -1 // Player is toting it
#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 CARRIED -1 // Player is toting it
#define READ_MODE "rb" // b is not needed for POSIX but harmless
#define WRITE_MODE "wb" // b is not needed for POSIX but harmless
diff --git
a/misc.c
b/misc.c
index 2b6a58b212a7561eab784dad1a151566319cab4f..6e3656f50fd90e9144e9f27177fc9a10673391ad 100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-483,6
+483,10
@@
int get_special_vocab_id(const char* word)
long get_vocab_id(const char* word)
// Search the vocab categories in order for the supplied word.
{
long get_vocab_id(const char* 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;
/* FIXME: Magic numbers related to vocabulary */
long ref_num;
/* FIXME: Magic numbers related to vocabulary */