diff options
Diffstat (limited to 'engines/sci/scicore')
-rw-r--r-- | engines/sci/scicore/vocabulary.cpp | 12 | ||||
-rw-r--r-- | engines/sci/scicore/vocabulary.h | 14 |
2 files changed, 8 insertions, 18 deletions
diff --git a/engines/sci/scicore/vocabulary.cpp b/engines/sci/scicore/vocabulary.cpp index fac3af1c20..283029b226 100644 --- a/engines/sci/scicore/vocabulary.cpp +++ b/engines/sci/scicore/vocabulary.cpp @@ -599,16 +599,14 @@ void vocab_dump_parse_tree(const char *tree_name, parse_tree_node_t *nodes) { sciprintf("))\n"); } -void vocab_synonymize_tokens(ResultWordList &words, synonym_t *synonyms, int synonyms_nr) { - int sync; - - if (!synonyms || !synonyms_nr) +void vocab_synonymize_tokens(ResultWordList &words, const SynonymList &synonyms) { + if (synonyms.empty()) return; // No synonyms: Nothing to check for (ResultWordList::iterator i = words.begin(); i != words.end(); ++i) - for (sync = 0; sync < synonyms_nr; sync++) - if (i->group == synonyms[sync].replaceant) - i->group = synonyms[sync].replacement; + for (SynonymList::const_iterator sync = synonyms.begin(); sync != synonyms.end(); ++sync) + if (i->group == sync->replaceant) + i->group = sync->replacement; } } // End of namespace Sci diff --git a/engines/sci/scicore/vocabulary.h b/engines/sci/scicore/vocabulary.h index 6ad583a6c4..41562e092d 100644 --- a/engines/sci/scicore/vocabulary.h +++ b/engines/sci/scicore/vocabulary.h @@ -165,13 +165,11 @@ struct synonym_t { int replacement; /* The replacement word group for this one */ }; +typedef Common::List<synonym_t> SynonymList; struct parse_tree_branch_t { - int id; - int data[10]; - }; #define PARSE_TREE_NODE_LEAF 0 @@ -179,16 +177,11 @@ struct parse_tree_branch_t { struct parse_tree_node_t { - short type; /* leaf or branch */ - union { - int value; /* For leaves */ short branches[2]; /* For branches */ - } content; - }; @@ -374,11 +367,10 @@ void vocab_decypher_said_block(EngineState *s, byte *pos); */ -void vocab_synonymize_tokens(ResultWordList &words, synonym_t *synonyms, int synonyms_nr); +void vocab_synonymize_tokens(ResultWordList &words, const SynonymList &synonyms); /* Synonymizes a token list ** Parameters: (ResultWordList &) words: The word list to synonymize -** (synonym_t *) synonyms: Synonym list -** (int) synonyms_nr: Number of synonyms in the list +** (const SynonymList &) synonyms: Synonym list */ int vocab_gnf_parse(parse_tree_node_t *nodes, const ResultWordList &words, |