aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sword25/kernel/common.h2
-rw-r--r--engines/sword25/kernel/kernel.cpp6
-rw-r--r--engines/sword25/package/packagemanager_script.cpp4
-rw-r--r--engines/sword25/script/lua_extensions.cpp4
-rw-r--r--engines/sword25/script/luabindhelper.cpp13
-rw-r--r--engines/sword25/script/luascript.cpp8
-rw-r--r--engines/sword25/sword25.cpp10
7 files changed, 29 insertions, 18 deletions
diff --git a/engines/sword25/kernel/common.h b/engines/sword25/kernel/common.h
index dcae17f02b..3bd385e149 100644
--- a/engines/sword25/kernel/common.h
+++ b/engines/sword25/kernel/common.h
@@ -54,6 +54,8 @@
#include "sword25/kernel/memleaks.h"
#include "sword25/kernel/log.h"
+#include "common/debug.h"
+
#define BS_ASSERT(EXP) assert(EXP)
#endif
diff --git a/engines/sword25/kernel/kernel.cpp b/engines/sword25/kernel/kernel.cpp
index 6348ca0f63..6150024e20 100644
--- a/engines/sword25/kernel/kernel.cpp
+++ b/engines/sword25/kernel/kernel.cpp
@@ -180,12 +180,12 @@ BS_Service *BS_Kernel::Superclass::NewService(const Common::String &ServiceIdent
for (unsigned int i = 0; i < BS_SERVICE_COUNT; i++)
if (BS_SERVICE_TABLE[i].SuperclassIdentifier == _Identifier &&
BS_SERVICE_TABLE[i].ServiceIdentifier == ServiceIdentifier) {
- BS_Service *NewService = BS_SERVICE_TABLE[i].CreateMethod(_pKernel);
+ BS_Service *NewService_ = BS_SERVICE_TABLE[i].CreateMethod(_pKernel);
- if (NewService) {
+ if (NewService_) {
DisconnectService();
BS_LOGLN("Service '%s' created from superclass '%s'.", ServiceIdentifier.c_str(), _Identifier.c_str());
- _ActiveService = NewService;
+ _ActiveService = NewService_;
_ActiveServiceName = BS_SERVICE_TABLE[i].ServiceIdentifier;
return _ActiveService;
} else {
diff --git a/engines/sword25/package/packagemanager_script.cpp b/engines/sword25/package/packagemanager_script.cpp
index a7c845d32f..3719593e23 100644
--- a/engines/sword25/package/packagemanager_script.cpp
+++ b/engines/sword25/package/packagemanager_script.cpp
@@ -195,9 +195,9 @@ static int GetFileAsString(lua_State *L) {
BS_PackageManager *pPM = GetPM();
unsigned int FileSize;
- void *FileData = pPM->GetFile(luaL_checkstring(L, 1), &FileSize);
+ char *FileData = (char *)pPM->GetFile(luaL_checkstring(L, 1), &FileSize);
if (FileData) {
- lua_pushlstring(L, static_cast<char *>(FileData), FileSize);
+ lua_pushlstring(L, FileData, FileSize);
delete FileData;
return 1;
diff --git a/engines/sword25/script/lua_extensions.cpp b/engines/sword25/script/lua_extensions.cpp
index f069da5075..91303ac8e0 100644
--- a/engines/sword25/script/lua_extensions.cpp
+++ b/engines/sword25/script/lua_extensions.cpp
@@ -66,8 +66,8 @@ static int Warning(lua_State *L) {
// -----------------------------------------------------------------------------
static const luaL_reg GLOBAL_FUNCTIONS[] = {
- "warning", Warning,
- 0, 0,
+ {"warning", Warning},
+ {0, 0}
};
// -----------------------------------------------------------------------------
diff --git a/engines/sword25/script/luabindhelper.cpp b/engines/sword25/script/luabindhelper.cpp
index 76e8faac8e..a4f42331e6 100644
--- a/engines/sword25/script/luabindhelper.cpp
+++ b/engines/sword25/script/luabindhelper.cpp
@@ -110,9 +110,7 @@ bool BS_LuaBindhelper::AddFunctionsToLib(lua_State *L, const Common::String &Lib
lua_gettable(L, LUA_GLOBALSINDEX);
RegisterPermanent(L, Functions->name);
}
- }
- // If the table name is not empty, the functions are added to the given table
- else {
+ } else { // If the table name is not empty, the functions are added to the given table
// Ensure that the library table exists
if (!_CreateTable(L, LibName)) return false;
@@ -329,11 +327,13 @@ bool BS_LuaBindhelper::_CreateTable(lua_State *L, const Common::String &TableNam
while (PartBegin) {
const char *PartEnd = strchr(PartBegin, '.');
- if (!PartEnd) PartEnd = PartBegin + strlen(PartBegin);
+ if (!PartEnd)
+ PartEnd = PartBegin + strlen(PartBegin);
Common::String SubTableName(PartBegin, PartEnd - PartBegin);
// Tables with an empty string as the name are not allowed
- if (SubTableName.size() == 0) return false;
+ if (SubTableName.size() == 0)
+ return false;
// Verify that the table with the name already exists
// The first round will be searched in the global namespace, with later passages
@@ -344,7 +344,8 @@ bool BS_LuaBindhelper::_CreateTable(lua_State *L, const Common::String &TableNam
} else {
lua_pushstring(L, SubTableName.c_str());
lua_gettable(L, -2);
- if (!lua_isnil(L, -1)) lua_remove(L, -2);
+ if (!lua_isnil(L, -1))
+ lua_remove(L, -2);
}
// If it doesn't exist, create table
diff --git a/engines/sword25/script/luascript.cpp b/engines/sword25/script/luascript.cpp
index 2d475e1ed6..c6cfeb96ce 100644
--- a/engines/sword25/script/luascript.cpp
+++ b/engines/sword25/script/luascript.cpp
@@ -75,7 +75,8 @@ BS_LuaScriptEngine::BS_LuaScriptEngine(BS_Kernel *KernelPtr) :
BS_LuaScriptEngine::~BS_LuaScriptEngine() {
// Lua de-initialisation
- if (m_State) lua_close(m_State);
+ if (m_State)
+ lua_close(m_State);
}
// -----------------------------------------------------------------------------
@@ -149,6 +150,7 @@ bool BS_LuaScriptEngine::ExecuteFile(const Common::String &FileName) {
#ifdef DEBUG
int __startStackDepth = lua_gettop(m_State);
#endif
+ debug(0, "ExecuteFile(%s)", FileName.c_str());
// Get a pointer to the package manager
BS_PackageManager *pPackage = static_cast<BS_PackageManager *>(BS_Kernel::GetInstance()->GetService("package"));
@@ -219,6 +221,8 @@ bool BS_LuaScriptEngine::RegisterStandardLibs() {
// -----------------------------------------------------------------------------
bool BS_LuaScriptEngine::ExecuteBuffer(const char *Data, unsigned int Size, const Common::String &Name) const {
+ debug(0, "ExecuteBuffer()");
+
// Compile buffer
if (luaL_loadbuffer(m_State, Data, Size, Name.c_str()) != 0) {
BS_LOG_ERRORLN("Couldn't compile \"%s\":\n%s", Name.c_str(), lua_tostring(m_State, -1));
@@ -250,6 +254,8 @@ bool BS_LuaScriptEngine::ExecuteBuffer(const char *Data, unsigned int Size, cons
// -----------------------------------------------------------------------------
void BS_LuaScriptEngine::SetCommandLine(const Common::StringArray &CommandLineParameters) {
+ debug(0, "SetCommandLine()");
+
lua_newtable(m_State);
for (size_t i = 0; i < CommandLineParameters.size(); ++i) {
diff --git a/engines/sword25/sword25.cpp b/engines/sword25/sword25.cpp
index a6aa79cc4c..d34927f0de 100644
--- a/engines/sword25/sword25.cpp
+++ b/engines/sword25/sword25.cpp
@@ -90,7 +90,7 @@ Common::Error Sword25Engine::AppStart(const Common::StringArray &CommandParamete
if (format != g_system->getScreenFormat())
return Common::kUnsupportedColorMode;
- // Kernel initialisation
+ // Kernel initialization
if (!BS_Kernel::GetInstance()->GetInitSuccess()) {
BS_LOG_ERRORLN("Kernel initialization failed.");
return Common::kUnknownError;
@@ -105,15 +105,17 @@ Common::Error Sword25Engine::AppStart(const Common::StringArray &CommandParamete
// Packages laden oder das aktuelle Verzeichnis mounten, wenn das über Kommandozeile angefordert wurde.
if (find(CommandParameters.begin(), CommandParameters.end(), MOUNT_DIR_PARAMETER) != CommandParameters.end()) {
- if (!PackageManagerPtr->LoadDirectoryAsPackage(".", "/")) return Common::kUnknownError;
+ if (!PackageManagerPtr->LoadDirectoryAsPackage(".", "/"))
+ return Common::kUnknownError;
} else {
- if (!LoadPackages()) return Common::kUnknownError;
+ if (!LoadPackages())
+ return Common::kUnknownError;
}
// Einen Pointer auf den Skript-Engine holen.
BS_ScriptEngine *ScriptPtr = static_cast<BS_ScriptEngine *>(BS_Kernel::GetInstance()->GetService("script"));
if (!ScriptPtr) {
- BS_LOG_ERRORLN("Skript intialization failed.");
+ BS_LOG_ERRORLN("Script intialization failed.");
return Common::kUnknownError;
}