From d9a9fac93761a06e78fe7e7091ae5a888c1260f2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 8 Mar 2006 11:37:25 +0000 Subject: Fixed tons of format string warnings for debug/error calls (including several errors where the format string didn't match the number of arguments to the call) svn-id: r21141 --- engines/scumm/akos.cpp | 6 +++--- engines/scumm/he/resource_he.cpp | 1 - engines/scumm/he/script_v72he.cpp | 2 +- engines/scumm/he/script_v90he.cpp | 2 +- engines/scumm/resource.cpp | 42 +++++++++++++++++++++++++++++++++++++++ engines/scumm/scumm.cpp | 4 +++- 6 files changed, 50 insertions(+), 7 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index 6694892682..915965608c 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -220,7 +220,7 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) { akst += 8; } if (!found) { - error("Sequence not found in actor %p costume %d", a, a->_costume); + error("Sequence not found in actor %p costume %d", (void *)a, a->_costume); } } } @@ -251,7 +251,7 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) { aksf += 6; } if (!found) { - error("Sequence not found in actor %p costume %d", a, a->_costume); + error("Sequence not found in actor %p costume %d", (void *)a, a->_costume); } } } @@ -275,7 +275,7 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) { akst += 8; } if (!found) { - error("Sequence not found in actor %p costume %d", a, a->_costume); + error("Sequence not found in actor %p costume %d", (void *)a, a->_costume); } } } diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 3d99325db9..931c946965 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -164,7 +164,6 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte if (_vm->_substResFileName.almostGameID != 0) { char buf1[128]; - _vm->generateSubstResFileName(_fileName, buf1, sizeof(buf1)); strcpy(_fileName, buf1); } diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index 9c1dcf7c0b..2948b0fdfa 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -2128,7 +2128,7 @@ void ScummEngine_v72he::copyArrayHelper(ArrayHeader *ah, int idx2, int idx1, int *data = ah->data + offset * 4; break; default: - error("Invalid array type", FROM_LE_32(ah->type)); + error("Invalid array type %d", FROM_LE_32(ah->type)); } } diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp index 2f6d0569c2..a77373790e 100644 --- a/engines/scumm/he/script_v90he.cpp +++ b/engines/scumm/he/script_v90he.cpp @@ -2303,7 +2303,7 @@ void ScummEngine_v90he::sortArray(int array, int dim2start, int dim2end, int dim } break; default: - error("Invalid array type", FROM_LE_32(ah->type)); + error("Invalid array type %d", FROM_LE_32(ah->type)); } } diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 2acd6ae233..60b04f18ae 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -62,6 +62,48 @@ static bool checkTryMedia(BaseScummFile *handle); #endif +#if 0 +Common::String generateFilename(int room, int diskNumber) { + char buf[128]; + + if (_game.version == 4) { + if (room == 0 || room >= 900) { + sprintf(buf, "%.3d.lfl", room); + } else { + sprintf(buf, "disk%.2d.lec", diskNumber); + } + } else if (_game.heversion >= 98) { + char c; + int disk = 0; + if (_heV7DiskOffsets) + disk = _heV7DiskOffsets[room]; + + switch(disk) { + case 2: + c = 'b'; + break; + case 1: + c = 'a'; + break; + default: + c = '0'; + } + sprintf(buf, _substEntry.formatStr, c); + + } else if (_substEntry.method == kGenDiskNum) { + sprintf(buf, _substEntry.formatStr, diskNumber); + + } else if (_substEntry.method == kGenRoomNum) { + sprintf(buf, _substEntry.formatStr, room); + + } else { + error("FOO"); + } + + return buf; +} +#endif + /* Open a room */ void ScummEngine::openRoom(const int room) { bool result; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index f077149fee..b28b3a1cb6 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1606,7 +1606,9 @@ void ScummEngine_v99he::scummInit() { memset(_hePalettes, 0, (_numPalettes + 1) * 1024); // Array 129 is set to base name - int len = resStrLen((const byte *)_baseName.c_str()) + 1; + // FIXME: Of course, we probably would want to insert the value + // *after* applying the filename substitution here... ? + int len = _baseName.size() + 1; ArrayHeader *ah = defineArray(129, kStringArray, 0, 0, 0, len); memcpy(ah->data, _baseName.c_str(), len); -- cgit v1.2.3