From ef4273ba47a2da9cea0aed59235e2d0a86bb8d7e Mon Sep 17 00:00:00 2001 From: John Fultz Date: Tue, 13 Oct 2015 12:00:13 -0500 Subject: Saving custom dictionaries now really works. * Fix a number of remaining bugs in the lexicon dialog. * Fix an error reading the v1 DAWG. * Improve the word counting mechanism. * Make sure the lexicn dialog properly selects and loads its dictionary after it's done. * Implement deleting of user dictionaries. * Clean up dictionary info text in lexicon dialog. * Disable gaddag generation...still have to fix that up to happen at sensible times and with user notification. --- lexiconparameters.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lexiconparameters.cpp') diff --git a/lexiconparameters.cpp b/lexiconparameters.cpp index bc10773..74de78f 100644 --- a/lexiconparameters.cpp +++ b/lexiconparameters.cpp @@ -82,8 +82,6 @@ class Quackle::V1LexiconInterpreter : public LexiconInterpreter file >> lexparams.m_utf8Alphabet[i]; file.get(); // separator space } - file.get(); // whitespace separator - lexparams.m_wordcount = (bytes[0] << 16) | (bytes[1] << 8) | bytes[2]; while (!file.eof()) { file.read((char*)(lexparams.m_dawg) + i, 7); @@ -123,18 +121,18 @@ class Quackle::V1LexiconInterpreter : public LexiconInterpreter p = (dawg[index] << 16) + (dawg[index + 1] << 8) + (dawg[index + 2]); letter = dawg[index + 3]; - t = (p != 0); lastchild = ((letter & 64) != 0); british = !(letter & 128); letter = (letter & 63) + QUACKLE_FIRST_LETTER; playability = (dawg[index + 4] << 16) + (dawg[index + 5] << 8) + (dawg[index + 6]); + t = (playability != 0); } virtual int versionNumber() const { return 1; } }; LexiconParameters::LexiconParameters() - : m_dawg(NULL), m_gaddag(NULL), m_interpreter(NULL), m_wordcount(0) + : m_dawg(NULL), m_gaddag(NULL), m_interpreter(NULL), m_wordCount(0) { memset(m_hash, 0, sizeof(m_hash)); } @@ -155,6 +153,7 @@ void LexiconParameters::unloadDawg() delete[] m_dawg; m_dawg = NULL; delete m_interpreter; + m_interpreter = NULL; } void LexiconParameters::unloadGaddag() -- cgit v1.2.3