Swapped the checks for suffixes and branches to first check for SCI1 resources, and then for SCI0 resources (as in SCI1 games, tree branches are in resource 901, which coincides with the SCI0 suffix vocabulary resource 901)

svn-id: r41026
This commit is contained in:
Filippos Karapetis 2009-05-30 10:54:25 +00:00
parent c7c9f05cac
commit 33a924e766

View File

@ -225,11 +225,11 @@ const char *vocab_get_any_group_word(int group, const WordMap &words) {
}
bool vocab_get_suffixes(ResourceManager *resmgr, SuffixList &suffixes) {
// Determine if we got a SCI0 vocabulary loaded
Resource* resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB, 1);
// Determine if we can find a SCI1 suffix vocabulary first
Resource* resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB, 1);
if (!resource)
// No SCI0 vocabulary? Try SCI1
resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB, 1);
// No SCI1 vocabulary? Try SCI0
resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB, 1);
if (!resource)
return false; // No vocabulary found
@ -263,25 +263,26 @@ bool vocab_get_suffixes(ResourceManager *resmgr, SuffixList &suffixes) {
}
void vocab_free_suffixes(ResourceManager *resmgr, SuffixList &suffixes) {
// Determine if we got a SCI0 vocabulary loaded
Resource* resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB, 0);
// Determine if we got a SCI1 vocabulary loaded
Resource* resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB, 0);
if (resource && resource->status == kResStatusLocked) {
resmgr->unlockResource(resource, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB, kResourceTypeVocab);
resmgr->unlockResource(resource, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB, kResourceTypeVocab);
} else {
// No SCI0 vocabulary? Try SCI1
resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB, 0);
// No SCI1 vocabulary? Try SCI0
resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB, 0);
if (resource && resource->status == kResStatusLocked)
resmgr->unlockResource(resource, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB, kResourceTypeVocab);
resmgr->unlockResource(resource, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB, kResourceTypeVocab);
}
suffixes.clear();
}
bool vocab_get_branches(ResourceManager * resmgr, Common::Array<parse_tree_branch_t> &branches) {
Resource *resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_PARSE_TREE_BRANCHES, 0);
// Determine if we can find a SCI1 parser tree first
Resource *resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_PARSE_TREE_BRANCHES, 0);
if (!resource)
// No SCI0 parser tree? Try SCI1
resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_PARSE_TREE_BRANCHES, 0);
// No SCI1 parser tree? Try SCI0
resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_PARSE_TREE_BRANCHES, 0);
branches.clear();