From 5978d8f63d5f67ece8d275f7959d99ccc92ac171 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jan 2011 17:29:08 +0000 Subject: SWORD25: Marked several unused LUA callbacks as dummy functions. Some cleanup. svn-id: r55597 --- engines/sword25/kernel/filesystemutil.h | 7 --- engines/sword25/package/packagemanager.cpp | 4 -- engines/sword25/package/packagemanager.h | 2 +- engines/sword25/package/packagemanager_script.cpp | 54 +++++------------------ 4 files changed, 12 insertions(+), 55 deletions(-) diff --git a/engines/sword25/kernel/filesystemutil.h b/engines/sword25/kernel/filesystemutil.h index 38a3fdaa12..b75454c1c8 100644 --- a/engines/sword25/kernel/filesystemutil.h +++ b/engines/sword25/kernel/filesystemutil.h @@ -75,13 +75,6 @@ public: */ static Common::String getPathSeparator(); - /** - * @param Filename The path to a file. - * @return Returns the size of the specified file. If the size could not be - * determined, or the file does not exist, returns -1 - */ - static int32 getFileSize(const Common::String &filename); - /** * @param Filename The path to a file. * @return Returns true if the file exists. diff --git a/engines/sword25/package/packagemanager.cpp b/engines/sword25/package/packagemanager.cpp index 91bd6eb855..7a64fe2e29 100644 --- a/engines/sword25/package/packagemanager.cpp +++ b/engines/sword25/package/packagemanager.cpp @@ -199,10 +199,6 @@ Common::SeekableReadStream *PackageManager::getStream(const Common::String &file return in; } -Common::String PackageManager::getCurrentDirectory() { - return _currentDirectory; -} - bool PackageManager::changeDirectory(const Common::String &directory) { // Get the path elements for the file _currentDirectory = normalizePath(directory, _currentDirectory); diff --git a/engines/sword25/package/packagemanager.h b/engines/sword25/package/packagemanager.h index 03598012a6..3a976b32fa 100644 --- a/engines/sword25/package/packagemanager.h +++ b/engines/sword25/package/packagemanager.h @@ -161,7 +161,7 @@ public: * If the path could not be determined, an empty string is returned. * @remark For cutting path elements '\' is used rather than '/' elements. */ - Common::String getCurrentDirectory(); + Common::String getCurrentDirectory() { return _currentDirectory; } /** * Changes the current directory. * @param Directory The path to the new directory. The path can be relative. diff --git a/engines/sword25/package/packagemanager_script.cpp b/engines/sword25/package/packagemanager_script.cpp index 1c9c973d45..eab66f7531 100644 --- a/engines/sword25/package/packagemanager_script.cpp +++ b/engines/sword25/package/packagemanager_script.cpp @@ -65,44 +65,6 @@ static int loadDirectoryAsPackage(lua_State *L) { return 1; } -static int getCurrentDirectory(lua_State *L) { - PackageManager *pPM = getPM(); - - lua_pushstring(L, pPM->getCurrentDirectory().c_str()); - - return 1; -} - -static int changeDirectory(lua_State *L) { - PackageManager *pPM = getPM(); - - lua_pushbooleancpp(L, pPM->changeDirectory(luaL_checkstring(L, 1))); - - return 1; -} - -static int getAbsolutePath(lua_State *L) { - PackageManager *pPM = getPM(); - - lua_pushstring(L, pPM->getAbsolutePath(luaL_checkstring(L, 1)).c_str()); - - return 1; -} - -static int getFileSize(lua_State *L) { - // This function apparently is not used by the game scripts - lua_pushnumber(L, 0); - - return 1; -} - -static int getFileType(lua_State *L) { - // This function apparently is not used by the game scripts - lua_pushnumber(L, 0); - - return 1; -} - static void splitSearchPath(const Common::String &path, Common::String &directory, Common::String &filter) { // Scan backwards for a trailing slash const char *sPath = path.c_str(); @@ -177,16 +139,22 @@ static int fileExists(lua_State *L) { return 1; } +// Marks a function that should never be used +static int dummyFuncError(lua_State *L) { + error("Dummy function invoked by LUA"); + return 1; +} + static const char *PACKAGE_LIBRARY_NAME = "Package"; static const luaL_reg PACKAGE_FUNCTIONS[] = { {"LoadPackage", loadPackage}, {"LoadDirectoryAsPackage", loadDirectoryAsPackage}, - {"GetCurrentDirectory", getCurrentDirectory}, - {"ChangeDirectory", changeDirectory}, - {"GetAbsolutePath", getAbsolutePath}, - {"GetFileSize", getFileSize}, - {"GetFileType", getFileType}, + {"GetCurrentDirectory", dummyFuncError}, + {"ChangeDirectory", dummyFuncError}, + {"GetAbsolutePath", dummyFuncError}, + {"GetFileSize", dummyFuncError}, + {"GetFileType", dummyFuncError}, {"FindFiles", findFiles}, {"FindDirectories", findDirectories}, {"GetFileAsString", getFileAsString}, -- cgit v1.2.3