Fixing const related warnings in the parallaction engine

svn-id: r25095
This commit is contained in:
Max Horn 2007-01-15 21:14:34 +00:00
parent a90529c323
commit abb7d49bca
10 changed files with 38 additions and 37 deletions

View File

@ -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) {

View File

@ -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);
}

View File

@ -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) {

View File

@ -151,7 +151,7 @@ protected:
static byte * _buffers[NUM_BUFFERS];
static byte _mouseArrow[256];
static byte _mouseArrow[256];
static StaticCnv _mouseComposedArrow;
protected:

View File

@ -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++;

View File

@ -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,

View File

@ -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);

View File

@ -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",

View File

@ -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;

View File

@ -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;