From abb7d49bcaf90ddeb0fb10a30d6bd83c8ac574d8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 15 Jan 2007 21:14:34 +0000 Subject: [PATCH] Fixing const related warnings in the parallaction engine svn-id: r25095 --- engines/parallaction/animation.cpp | 2 +- engines/parallaction/commands.cpp | 18 ++++++++---------- engines/parallaction/dialogue.cpp | 6 +++--- engines/parallaction/graphics.h | 2 +- engines/parallaction/location.cpp | 2 +- engines/parallaction/parallaction.cpp | 4 +++- engines/parallaction/parallaction.h | 16 ++++++++-------- engines/parallaction/staticres.cpp | 13 +++++++------ engines/parallaction/table.cpp | 2 +- engines/parallaction/zone.cpp | 10 +++++----- 10 files changed, 38 insertions(+), 37 deletions(-) diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp index 33ca821b707..28ad30ae816 100644 --- a/engines/parallaction/animation.cpp +++ b/engines/parallaction/animation.cpp @@ -98,7 +98,7 @@ Animation *Parallaction::parseAnimation(ArchivedFile *file, Node *list, char *na } if (!scumm_stricmp(_tokens[0], "type")) { if (_tokens[2][0] != '\0') { - vD0->_zone._type = ((4 + searchTable(_tokens[2], _objectsNames)) << 16) & 0xFFFF0000; + vD0->_zone._type = ((4 + searchTable(_tokens[2], (const char **)_objectsNames)) << 16) & 0xFFFF0000; } int16 _si = searchTable(_tokens[1], _zoneTypeNames); if (_si != -1) { diff --git a/engines/parallaction/commands.cpp b/engines/parallaction/commands.cpp index aa726edaad4..4dc8775a473 100644 --- a/engines/parallaction/commands.cpp +++ b/engines/parallaction/commands.cpp @@ -44,8 +44,6 @@ namespace Parallaction { #define CMD_MOVE 15 #define CMD_STOP 16 -extern char *_callableNames[]; - Command *parseCommands(ArchivedFile *file) { // printf("parseCommands()\n"); @@ -70,9 +68,9 @@ Command *parseCommands(ArchivedFile *file) { case CMD_SET: // set case CMD_CLEAR: // clear case CMD_TOGGLE: // toggle - if (_vm->searchTable(_tokens[1], _globalTable) == -1) { + if (_vm->searchTable(_tokens[1], (const char **)_globalTable) == -1) { do { - char _al = _vm->searchTable(_tokens[_si], _localFlagNames); + char _al = _vm->searchTable(_tokens[_si], (const char **)_localFlagNames); _si++; cmd->u._flags |= 1 << (_al - 1); } while (!scumm_stricmp(_tokens[_si++], "|")); @@ -80,7 +78,7 @@ Command *parseCommands(ArchivedFile *file) { } else { cmd->u._flags |= kFlagsGlobal; do { - char _al = _vm->searchTable(_tokens[1], _globalTable); + char _al = _vm->searchTable(_tokens[1], (const char **)_globalTable); _si++; cmd->u._flags |= 1 << (_al - 1); } while (!scumm_stricmp(_tokens[_si++], "|")); @@ -121,7 +119,7 @@ Command *parseCommands(ArchivedFile *file) { break; case CMD_DROP: // drop - cmd->u._object = _vm->searchTable(_tokens[_si], _objectsNames); + cmd->u._object = _vm->searchTable(_tokens[_si], (const char **)_objectsNames); _si++; break; @@ -148,10 +146,10 @@ Command *parseCommands(ArchivedFile *file) { cmd->_flagsOn |= kFlagsEnter; } else if (!scumm_strnicmp(_tokens[_si], "no", 2)) { - byte _al = _vm->searchTable(&_tokens[_si][2], _localFlagNames); + byte _al = _vm->searchTable(&_tokens[_si][2], (const char **)_localFlagNames); cmd->_flagsOff |= 1 << (_al - 1); } else { - byte _al = _vm->searchTable(_tokens[_si], _localFlagNames); + byte _al = _vm->searchTable(_tokens[_si], (const char **)_localFlagNames); cmd->_flagsOn |= 1 << (_al - 1); } @@ -173,10 +171,10 @@ Command *parseCommands(ArchivedFile *file) { cmd->_flagsOn |= kFlagsEnter; } else if (!scumm_strnicmp(_tokens[_si], "no", 2)) { - byte _al = _vm->searchTable(&_tokens[_si][2], _globalTable); + byte _al = _vm->searchTable(&_tokens[_si][2], (const char **)_globalTable); cmd->_flagsOff |= 1 << (_al - 1); } else { - byte _al = _vm->searchTable(_tokens[_si], _localFlagNames); + byte _al = _vm->searchTable(_tokens[_si], (const char **)_localFlagNames); cmd->_flagsOn |= 1 << (_al - 1); } diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index eacc3af67bd..7c11a0fb161 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -93,14 +93,14 @@ Dialogue *parseDialogue(ArchivedFile *file) { parseFillBuffers(); while (scumm_stricmp(_tokens[0], "endquestion")) { // parse answers - char** v60 = _localFlagNames; + const char** v60 = (const char **)_localFlagNames; uint16 v56 = 1; if (_tokens[1][0]) { if (!scumm_stricmp(_tokens[1], "global")) { v56 = 2; - v60 = _globalTable; + v60 = (const char **)_globalTable; vB4->_yesFlags[_di] |= kFlagsGlobal; } @@ -149,7 +149,7 @@ Dialogue *parseDialogue(ArchivedFile *file) { for (uint16 v5A = 0; v5A < 5; v5A++) { if (_questions[_si]->_answers[v5A] == 0) continue; - int16 v58 = _vm->searchTable(_questions[_si]->_following._names[v5A], _questions_names); + int16 v58 = _vm->searchTable(_questions[_si]->_following._names[v5A], (const char **)_questions_names); memFree(_questions[_si]->_following._names[v5A]); if (v58 == -1) { diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 8363b936293..e409f8a7143 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -151,7 +151,7 @@ protected: static byte * _buffers[NUM_BUFFERS]; - static byte _mouseArrow[256]; + static byte _mouseArrow[256]; static StaticCnv _mouseComposedArrow; protected: diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index 788027a9ac5..c6abbdf2bd4 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -150,7 +150,7 @@ void Parallaction::parseLocation(const char *filename) { _si = 1; do { - byte _al = searchTable(_tokens[_si], _localFlagNames); + byte _al = searchTable(_tokens[_si], (const char **)_localFlagNames); _localFlags[_currentLocationIndex] |= 1 << (_al - 1); _si++; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 9857365c269..44a378f5f10 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -56,8 +56,10 @@ char *_locationComment = NULL; char *_locationEndComment = NULL; uint32 _localFlags[120] = { 0 }; +static char tmp_visited_str[] = "visited"; + char *_localFlagNames[32] = { - "visited", + tmp_visited_str, // "visited", 0, 0, 0, diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 37d8e7f0cfe..efac55cfe72 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -114,13 +114,13 @@ extern char *_locationComment; extern char *_locationEndComment; extern char *_objectsNames[]; -extern char *_zoneTypeNames[]; -extern char *_zoneFlagNames[]; +extern const char *_zoneTypeNames[]; +extern const char *_zoneFlagNames[]; extern char *_localFlagNames[]; -extern char *commands_names[]; +extern const char *commands_names[]; -extern char *_instructionNames[]; -extern char *_callableNames[]; +extern const char *_instructionNames[]; +extern const char *_callableNames[]; void waitUntilLeftClick(); @@ -216,9 +216,9 @@ public: void waitTime(uint32 t); - void initTable(const char *path, char **table); - void freeTable(char** table); - int16 searchTable(const char *s, char **table); + static void initTable(const char *path, char **table); + static void freeTable(char** table); + static int16 searchTable(const char *s, const char **table); void parseLocation(const char *filename); void changeCursor(int32 index); diff --git a/engines/parallaction/staticres.cpp b/engines/parallaction/staticres.cpp index 3a8a6f73d57..a9599cd4001 100644 --- a/engines/parallaction/staticres.cpp +++ b/engines/parallaction/staticres.cpp @@ -47,7 +47,7 @@ byte Graphics::_mouseArrow[256] = { // // proportional font glyphs width // -byte _glyphWidths[126] = { +const byte _glyphWidths[126] = { 0x04, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, 0x06, 0x06, 0x03, 0x05, 0x03, 0x05, 0x06, 0x06, 0x06, 0x06, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x03, 0x03, 0x05, 0x04, 0x05, 0x05, 0x03, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x03, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, @@ -58,7 +58,7 @@ byte _glyphWidths[126] = { 0x05, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x06, 0x05, 0x05, 0x05, 0x05 }; -char *_zoneFlagNames[] = { +const char *_zoneFlagNames[] = { "closed", "active", "remove", @@ -73,7 +73,8 @@ char *_zoneFlagNames[] = { "nowalk", 0 }; -char *_zoneTypeNames[] = { + +const char *_zoneTypeNames[] = { "examine", "door", "get", @@ -102,7 +103,7 @@ const char _gameNames[10][20] = { "GAME10" }; -char *commands_names[] = { +const char *commands_names[] = { "set", "clear", "start", @@ -122,7 +123,7 @@ char *commands_names[] = { 0 }; -char *_instructionNames[] = { +const char *_instructionNames[] = { "on", "off", "x", @@ -144,7 +145,7 @@ char *_instructionNames[] = { 0 }; -char *_callableNames[] = { +const char *_callableNames[] = { "HBOff", "Projector", "StartIntro", diff --git a/engines/parallaction/table.cpp b/engines/parallaction/table.cpp index dc0c0a90dee..eba21faba71 100644 --- a/engines/parallaction/table.cpp +++ b/engines/parallaction/table.cpp @@ -114,7 +114,7 @@ void Parallaction::freeTable(char** table) { } -int16 Parallaction::searchTable(const char *s, char **table) { +int16 Parallaction::searchTable(const char *s, const char **table) { int16 count = 0; diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index fba746b245e..47af85366a4 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -86,7 +86,7 @@ void Parallaction::parseZone(ArchivedFile *file, Node *list, char *name) { } if (!scumm_stricmp(_tokens[0], "type")) { if (_tokens[2][0] != '\0') { - z->_type = (4 + searchTable(_tokens[2], _objectsNames)) << 16; + z->_type = (4 + searchTable(_tokens[2], (const char **)_objectsNames)) << 16; } int16 _si = searchTable(_tokens[1], _zoneTypeNames); if (_si != -1) { @@ -307,19 +307,19 @@ void Parallaction::parseZoneTypeBlock(ArchivedFile *file, Zone *z) { } if (!scumm_stricmp(_tokens[0], "icon")) { - u->get->_icon = 4 + searchTable(_tokens[1], _objectsNames); + u->get->_icon = 4 + searchTable(_tokens[1], (const char **)_objectsNames); } break; case kZoneMerge: // merge Zone init if (!scumm_stricmp(_tokens[0], "obj1")) { - u->merge->_obj1 = 4 + searchTable(_tokens[1], _objectsNames); + u->merge->_obj1 = 4 + searchTable(_tokens[1], (const char **)_objectsNames); } if (!scumm_stricmp(_tokens[0], "obj2")) { - u->merge->_obj2 = 4 + searchTable(_tokens[1], _objectsNames); + u->merge->_obj2 = 4 + searchTable(_tokens[1], (const char **)_objectsNames); } if (!scumm_stricmp(_tokens[0], "newobj")) { - u->merge->_obj3 = 4 + searchTable(_tokens[1], _objectsNames); + u->merge->_obj3 = 4 + searchTable(_tokens[1], (const char **)_objectsNames); } break;