[Scummvm-cvs-logs] SF.net SVN: scummvm:[53760] scummvm/trunk/engines/sword25/kernel

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Oct 24 03:53:33 CEST 2010


Revision: 53760
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53760&view=rev
Author:   fingolfin
Date:     2010-10-24 01:53:32 +0000 (Sun, 24 Oct 2010)

Log Message:
-----------
SWORD25: Remove some dead code; cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/kernel/resmanager.cpp
    scummvm/trunk/engines/sword25/kernel/resmanager.h

Modified: scummvm/trunk/engines/sword25/kernel/resmanager.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/resmanager.cpp	2010-10-24 01:53:01 UTC (rev 53759)
+++ scummvm/trunk/engines/sword25/kernel/resmanager.cpp	2010-10-24 01:53:32 UTC (rev 53760)
@@ -62,31 +62,6 @@
 }
 
 /**
- * Returns a resource by it's ordinal index. Returns NULL if any error occurs
- * Note: This method is not optimised for speed and should be used only for debugging purposes
- * @param ord       Ordinal number of the resource. Must be between 0 and GetResourceCount() - 1.
- */
-Resource *ResourceManager::getResourceByOrdinal(int ord) const {
-	// \xDCberpr\xFCfen ob der Index Ord innerhald der Listengrenzen liegt.
-	if (ord < 0 || ord >= getResourceCount()) {
-		BS_LOG_ERRORLN("Resource ordinal (%d) out of bounds (0 - %d).", ord, getResourceCount() - 1);
-		return NULL;
-	}
-
-	// Liste durchlaufen und die Resource mit dem gew\xFCnschten Index zur\xFCckgeben.
-	int curOrd = 0;
-	Common::List<Resource *>::const_iterator iter = _resources.begin();
-	for (; iter != _resources.end(); ++iter, ++curOrd) {
-		if (curOrd == ord)
-			return (*iter);
-	}
-
-	// Die Ausf\xFChrung sollte nie an diesem Punkt ankommen.
-	BS_LOG_EXTERRORLN("Execution reached unexpected point.");
-	return NULL;
-}
-
-/**
  * Registers a RegisterResourceService. This method is the constructor of
  * BS_ResourceService, and thus helps all resource services in the ResourceManager list
  * @param pService      Which service
@@ -125,7 +100,7 @@
 
 /**
  * Releases all resources that are not locked.
- **/
+ */
 void ResourceManager::emptyCache() {
 	// Scan through the resource list
 	Common::List<Resource *>::iterator iter = _resources.begin();
@@ -145,7 +120,7 @@
 Resource *ResourceManager::requestResource(const Common::String &fileName) {
 	// Get the absolute path to the file
 	Common::String uniqueFileName = getUniqueFileName(fileName);
-	if (uniqueFileName == "")
+	if (uniqueFileName.empty())
 		return NULL;
 
 	// Determine whether the resource is already loaded
@@ -163,8 +138,8 @@
 	if (_logCacheMiss)
 		BS_LOG_WARNINGLN("\"%s\" was not precached.", uniqueFileName.c_str());
 
-	Resource *pResource;
-	if ((pResource = loadResource(uniqueFileName))) {
+	Resource *pResource = loadResource(uniqueFileName);
+	if (pResource) {
 		pResource->addReference();
 		return pResource;
 	}
@@ -181,7 +156,7 @@
 bool ResourceManager::precacheResource(const Common::String &fileName, bool forceReload) {
 	// Get the absolute path to the file
 	Common::String uniqueFileName = getUniqueFileName(fileName);
-	if (uniqueFileName == "")
+	if (uniqueFileName.empty())
 		return false;
 
 	Resource *resourcePtr = getResource(uniqueFileName);
@@ -261,12 +236,12 @@
 	PackageManager *pPackage = (PackageManager *)_kernelPtr->getPackage();
 	if (!pPackage) {
 		BS_LOG_ERRORLN("Could not get package manager.");
-		return Common::String("");
+		return Common::String();
 	}
 
 	// Absoluten Pfad der Datei bekommen und somit die Eindeutigkeit des Dateinamens sicherstellen
 	Common::String uniquefileName = pPackage->getAbsolutePath(fileName);
-	if (uniquefileName == "")
+	if (uniquefileName.empty())
 		BS_LOG_ERRORLN("Could not create absolute file name for \"%s\".", fileName.c_str());
 
 	return uniquefileName;

Modified: scummvm/trunk/engines/sword25/kernel/resmanager.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/resmanager.h	2010-10-24 01:53:01 UTC (rev 53759)
+++ scummvm/trunk/engines/sword25/kernel/resmanager.h	2010-10-24 01:53:32 UTC (rev 53760)
@@ -66,20 +66,6 @@
 	bool precacheResource(const Common::String &fileName, bool forceReload = false);
 
 	/**
-	 * Returns the number of loaded resources
-	 */
-	int getResourceCount() const {
-		return static_cast<int>(_resources.size());
-	}
-
-	/**
-	 * Returns a resource by it's ordinal index. Returns NULL if any error occurs
-	 * Note: This method is not optimised for speed and should be used only for debugging purposes
-	 * @param Ord       Ordinal number of the resource. Must be between 0 and GetResourceCount() - 1.
-	*/
-	Resource *getResourceByOrdinal(int ord) const;
-
-	/**
 	 * Registers a RegisterResourceService. This method is the constructor of
 	 * BS_ResourceService, and thus helps all resource services in the ResourceManager list
 	 * @param pService      Which service


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