[Scummvm-cvs-logs] SF.net SVN: scummvm:[41044] scummvm/trunk/engines/sci/vocabulary.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat May 30 22:19:20 CEST 2009


Revision: 41044
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41044&view=rev
Author:   thebluegr
Date:     2009-05-30 20:19:20 +0000 (Sat, 30 May 2009)

Log Message:
-----------
Reverted the vocab loading function to be like it was before commit #40979 (but without the static variable)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/vocabulary.cpp

Modified: scummvm/trunk/engines/sci/vocabulary.cpp
===================================================================
--- scummvm/trunk/engines/sci/vocabulary.cpp	2009-05-30 20:01:43 UTC (rev 41043)
+++ scummvm/trunk/engines/sci/vocabulary.cpp	2009-05-30 20:19:20 UTC (rev 41044)
@@ -32,6 +32,8 @@
 
 namespace Sci {
 
+int vocab_version = 0;
+
 #if 0
 
 /**
@@ -146,7 +148,6 @@
 
 	// First try to load the SCI0 vocab resource.
 	Resource *resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB, 0);
-	int vocab_version = 0;
  
 	if (!resource) {
 		warning("SCI0: Could not find a main vocabulary, trying SCI01");
@@ -226,10 +227,12 @@
 
 bool vocab_get_suffixes(ResourceManager *resmgr, SuffixList &suffixes) {
 	// Determine if we can find a SCI1 suffix vocabulary first
-	Resource* resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB, 1);
-	if (!resource)
-		// No SCI1 vocabulary? Try SCI0
+	Resource* resource = NULL;
+	
+	if (vocab_version == 0)
 		resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB, 1);
+	else
+		resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB, 1);
 
 	if (!resource)
 		return false; // No vocabulary found
@@ -263,26 +266,26 @@
 }
 
 void vocab_free_suffixes(ResourceManager *resmgr, SuffixList &suffixes) {
-	// 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_SCI1_SUFFIX_VOCAB, kResourceTypeVocab);
-	} else {
-		// No SCI1 vocabulary? Try SCI0
+	Resource* resource = NULL;
+	
+	if (vocab_version == 0)
 		resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB, 0);
-		if (resource && resource->status == kResStatusLocked)
-			resmgr->unlockResource(resource, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB, kResourceTypeVocab);
-	}
+	else
+		resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB, 0);
+	
+	if (resource && resource->status == kResStatusLocked)
+		resmgr->unlockResource(resource, resource->number, kResourceTypeVocab);
 
 	suffixes.clear();
 }
 
 bool vocab_get_branches(ResourceManager * resmgr, Common::Array<parse_tree_branch_t> &branches) {
-	// 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 SCI1 parser tree? Try SCI0
+	Resource *resource = NULL;
+
+	if (vocab_version == 0)
 		resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_PARSE_TREE_BRANCHES, 0);
+	else
+		resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_PARSE_TREE_BRANCHES, 0);
 
 	branches.clear();
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list