From f9c560fd9a5630e25280150dbeca049a9ffaec24 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 1 Jul 2019 12:12:05 +0200 Subject: HDB: Fix warnings, const'ness --- engines/hdb/ai-funcs.cpp | 2 +- engines/hdb/ai-inventory.cpp | 2 +- engines/hdb/ai-lists.cpp | 2 +- engines/hdb/ai.h | 6 +++--- engines/hdb/lua-script.cpp | 16 ++++++++-------- 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'engines') diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp index a59e468b95..da4efc0d49 100644 --- a/engines/hdb/ai-funcs.cpp +++ b/engines/hdb/ai-funcs.cpp @@ -24,7 +24,7 @@ namespace HDB { -AIEntity *AI::spawn(AIType type, AIDir dir, int x, int y, char *funcInit, char *funcAction, char *funcUse, AIDir dir2, int level, int value1, int value2, int callInit) { +AIEntity *AI::spawn(AIType type, AIDir dir, int x, int y, const char *funcInit, const char *funcAction, const char *funcUse, AIDir dir2, int level, int value1, int value2, int callInit) { AIEntity *e = new AIEntity; e->type = type; diff --git a/engines/hdb/ai-inventory.cpp b/engines/hdb/ai-inventory.cpp index 0325d3b696..48ce48fb5a 100644 --- a/engines/hdb/ai-inventory.cpp +++ b/engines/hdb/ai-inventory.cpp @@ -243,7 +243,7 @@ bool AI::removeInvItemType(AIType which, int amount) { return true; } -bool AI::addItemToInventory(AIType type, int amount, char *funcInit, char *funcAction, char *funcUse) { +bool AI::addItemToInventory(AIType type, int amount, const char *funcInit, const char *funcAction, const char *funcUse) { int i; AIEntity *e; for (i = 0; i < amount; i++) { diff --git a/engines/hdb/ai-lists.cpp b/engines/hdb/ai-lists.cpp index ff0ecfb3fa..b60013a38b 100644 --- a/engines/hdb/ai-lists.cpp +++ b/engines/hdb/ai-lists.cpp @@ -762,7 +762,7 @@ bool AI::checkTriggerList(char *entName, int x, int y) { return false; } -void AI::killTrigger(char *id) { +void AI::killTrigger(const char *id) { for (Common::Array::iterator it = _triggerList->begin(); it != _triggerList->end(); it++) { if (!scumm_stricmp(id, (*it)->id)) _triggerList->erase(it); diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 4e424870e9..bf6503fb05 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -734,7 +734,7 @@ public: void initAnimInfo(); // Entity Functions - AIEntity *spawn(AIType type, AIDir dir, int x, int y, char *funcInit, char *funcAction, char *funcUse, AIDir dir2, int level, int value1, int value2, int callInit); + AIEntity *spawn(AIType type, AIDir dir, int x, int y, const char *funcInit, const char *funcAction, const char *funcUse, AIDir dir2, int level, int value1, int value2, int callInit); bool cacheEntGfx(AIEntity *e, bool init); void stopEntity(AIEntity *e); AIEntity *locateEntity(const char *luaName); @@ -798,7 +798,7 @@ public: ArrowPath *findArrowPath(int x, int y); void addToTriggerList(char *luaFuncInit, char *luaFuncUse, int x, int y, int value1, int value2, char *id); bool checkTriggerList(char *entName, int x, int y); - void killTrigger(char *id); + void killTrigger(const char *id); void floatEntity(AIEntity *e, AIState state); bool checkFloating(int x, int y); @@ -955,7 +955,7 @@ public: bool removeInvItem(const char *string, int amount); int queryInventoryType(AIType which); bool removeInvItemType(AIType which, int amount); - bool addItemToInventory(AIType type, int amount, char *funcInit, char *funcAction, char *funcUse); + bool addItemToInventory(AIType type, int amount, const char *funcInit, const char *funcAction, const char *funcUse); void keepInvItem(AIType type); void printYouGotMsg(const char *name); diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index 40582a54f7..72214b0233 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -651,7 +651,7 @@ static int dialog(lua_State *L) { lua_pop(L, 4); if (string) - g_hdb->_window->openDialog(title, (int)tileIndex, string, (int)more, more); + g_hdb->_window->openDialog(title, (int)tileIndex, string, more ? 1 : 0, more); return 0; } @@ -718,9 +718,9 @@ static int spawnEntity(lua_State *L) { double dir = lua_tonumber(L, 2); double x = lua_tonumber(L, 3); double y = lua_tonumber(L, 4); - char *funcInit = (char *)lua_tostring(L, 5); - char *funcAction = (char *)lua_tostring(L, 6); - char *funcUse = (char *)lua_tostring(L, 7); + const char *funcInit = lua_tostring(L, 5); + const char *funcAction = lua_tostring(L, 6); + const char *funcUse = lua_tostring(L, 7); double dir2 = lua_tonumber(L, 8); double level = lua_tonumber(L, 9); double value1 = lua_tonumber(L, 10); @@ -741,9 +741,9 @@ static int spawnEntity(lua_State *L) { static int addInvItem(lua_State *L) { double type = lua_tonumber(L, 1); double amount = lua_tonumber(L, 2); - char *funcInit = (char *)lua_tostring(L, 3); - char *funcAction = (char *)lua_tostring(L, 4); - char *funcUse = (char *)lua_tostring(L, 5); + const char *funcInit = lua_tostring(L, 3); + const char *funcAction = lua_tostring(L, 4); + const char *funcUse = lua_tostring(L, 5); int t = (int)type; @@ -838,7 +838,7 @@ static int removeInvItem(lua_State *L) { } static int killTrigger(lua_State *L) { - char *id = (char *)lua_tostring(L, 1); + const char *id = lua_tostring(L, 1); g_hdb->_lua->checkParameters("killTrigger", 1); -- cgit v1.2.3