* Look up foo in special section of vocab to determine which word we've got.
* Last word zips the eggs back to the giant room (unless already there). */
{
- char word[6];
+ char word[TOKLEN+1];
packed_to_token(foo, word);
int k = (int) get_special_vocab_id(word);
int spk = NOTHING_HAPPENS;
b = command->wd2x;
command->wd1 = command->wd2;
}
- char word1[6];
+ char word1[TOKLEN+1];
packed_to_token(command->wd1, word1);
int wd = (int) get_vocab_id(word1);
/* FIXME: magic numbers */
#include "dungeon.h"
#define LINESIZE 1024
+#define TOKLEN 5 // # sigificant character sin a token */
#define NDWARVES 6 // number of dwarves
#define PIRATE NDWARVES // must be NDWARVES-1 when zero-origin
#define DALTLC LOC_NUGGET // alternate dwarf location
long trnluz; // # points lost so far due to number of turns used
long turns; // how many commands he's given (ignores yes/no)
bool wzdark; // whether the loc he's leaving was dark
- char zzword[6]; // randomly generated magic word from bird
+ char zzword[TOKLEN+1]; // randomly generated magic word from bird
bool blooded; // has player drunk of dragon's blood?
long abbrev[NLOCATIONS + 1];
long atloc[NLOCATIONS + 1];
extern char* xstrdup(const char* s);
extern void* xmalloc(size_t size);
extern void packed_to_token(long, char token[]);
-extern long token_to_packed(const char token[6]);
+extern long token_to_packed(const char token[TOKLEN+1]);
extern void tokenize(char*, long tokens[4]);
extern void vspeak(const char*, bool, va_list);
extern bool wordeq(token_t, token_t);
} else
lampcheck();
- char word1[6];
- char word2[6];
+ char word1[TOKLEN+1];
+ char word2[TOKLEN+1];
packed_to_token(command.wd1, word1);
packed_to_token(command.wd2, word2);
V1 = get_vocab_id(word1);
return (ptr);
}
-void packed_to_token(long packed, char token[6])
+void packed_to_token(long packed, char token[TOKLEN+1])
{
// The advent->ascii mapping.
const char advent_to_ascii[] = {
}
}
-long token_to_packed(const char token[6])
+long token_to_packed(const char token[TOKLEN+1])
{
const char ascii_to_advent[] = {
63, 63, 63, 63, 63, 63, 63, 63,
int word_count = sscanf(raw, "%s%s", words[0], words[1]);
// make space for substrings and zero it out
- char chunk_data[][6] = {
+ char chunk_data[][TOKLEN+1] = {
{"\0\0\0\0\0"},
{"\0\0\0\0\0"},
{"\0\0\0\0\0"},
return range * get_next_lcg_value() / game.lcg_m;
}
-void make_zzword(char zzword[6])
+void make_zzword(char zzword[TOKLEN+1])
{
for (int i = 0; i < 5; ++i) {
zzword[i] = 'A' + randrange(26);