warning() and error() add a ! to the string automatically.

This commit is contained in:
Torbjorn Andersson 2009-05-31 07:33:18 +00:00
parent a3a72746fc
commit e90ad4af30
13 changed files with 64 additions and 64 deletions

View File

@ -83,7 +83,7 @@ void POSIXSaveFileManager::checkPath(const Common::FSNode &dir) {
if (mkdir(path.c_str(), 0755) != 0) {
// mkdir could fail for various reasons: The parent dir doesn't exist,
// or is not writeable, the path could be completly bogus, etc.
warning("mkdir for '%s' failed!", path.c_str());
warning("mkdir for '%s' failed", path.c_str());
perror("mkdir");
switch (errno) {

View File

@ -310,7 +310,7 @@ void Actor::sayLine(const char *msg, const char *msgId) {
textName += ".txt";
if (msgId[0] == 0) {
error("Actor::sayLine: No message ID for text!");
error("Actor::sayLine: No message ID for text");
return;
}

View File

@ -930,7 +930,7 @@ Model::HierNode *Costume::getModelNodes() {
void Costume::playChoreLooping(int num) {
if (num < 0 || num >= _numChores) {
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Requested chore number %d is outside the range of chores (0-%d)!", num, _numChores);
warning("Requested chore number %d is outside the range of chores (0-%d)", num, _numChores);
return;
}
_chores[num].playLooping();
@ -939,7 +939,7 @@ void Costume::playChoreLooping(int num) {
void Costume::playChore(int num) {
if (num < 0 || num >= _numChores) {
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Requested chore number %d is outside the range of chores (0-%d)!", num, _numChores);
warning("Requested chore number %d is outside the range of chores (0-%d)", num, _numChores);
return;
}
_chores[num].play();

View File

@ -633,7 +633,7 @@ void GfxOpenGL::destroyMaterial(Material *material) {
void GfxOpenGL::drawDepthBitmap(int x, int y, int w, int h, char *data) {
// if (num != 0) {
// warning("Animation not handled yet in GL texture path !");
// warning("Animation not handled yet in GL texture path");
// }
if (y + h == 480) {
glRasterPos2i(x, _screenHeight - 1);

View File

@ -481,13 +481,13 @@ void GrimEngine::handleDebugLoadResource() {
resource = (void *)1;
} else if (strstr(buf, ".mat")) {
CMap *cmap = g_resourceloader->loadColormap("item.cmp");
warning("Default colormap applied to resources loaded in this fashion!");
warning("Default colormap applied to resources loaded in this fashion");
resource = (void *)g_resourceloader->loadMaterial(buf, *cmap);
} else {
warning("Resource type not understood!");
warning("Resource type not understood");
}
if (!resource)
warning("Requested resouce (%s) not found!");
warning("Requested resouce (%s) not found");
}
void GrimEngine::drawPrimitives() {
@ -822,7 +822,7 @@ void GrimEngine::storeSaveGameImage(SaveGame *savedState) {
char *data = screenshot->getData();
savedState->write(data, size);
} else {
error("Unable to store screenshot!");
error("Unable to store screenshot");
}
savedState->endSection();
delete screenshot;
@ -920,7 +920,7 @@ void GrimEngine::setSceneLock(const char *name, bool lockStatus) {
if (!scene) {
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Scene object '%s' not found in list!", name);
warning("Scene object '%s' not found in list", name);
return;
}
// Change the locking status

View File

@ -106,7 +106,7 @@ int32 Imuse::getPosIn60HzTicks(const char *soundName) {
// Warn the user if the track was not found
if (getTrack == NULL) {
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Sound '%s' could not be found to get ticks!", soundName);
warning("Sound '%s' could not be found to get ticks", soundName);
return false;
}
@ -157,7 +157,7 @@ void Imuse::stopSound(const char *soundName) {
// Warn the user if the track was not found
if (removeTrack == NULL) {
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Sound track '%s' could not be found to stop!", soundName);
warning("Sound track '%s' could not be found to stop", soundName);
return;
}
flushTrack(removeTrack);

View File

@ -166,7 +166,7 @@ void Imuse::setPriority(const char *soundName, int priority) {
changeTrack = findTrack(soundName);
// Check to make sure we found the track
if (changeTrack == NULL) {
warning("Unable to find track '%s' to change priority!", soundName);
warning("Unable to find track '%s' to change priority", soundName);
return;
}
changeTrack->priority = priority;
@ -178,7 +178,7 @@ void Imuse::setVolume(const char *soundName, int volume) {
changeTrack = findTrack(soundName);
if (changeTrack == NULL) {
warning("Unable to find track '%s' to change volume!", soundName);
warning("Unable to find track '%s' to change volume", soundName);
return;
}
changeTrack->vol = volume * 1000;
@ -190,7 +190,7 @@ void Imuse::setPan(const char *soundName, int pan) {
changeTrack = findTrack(soundName);
if (changeTrack == NULL) {
warning("Unable to find track '%s' to change pan!", soundName);
warning("Unable to find track '%s' to change pan", soundName);
return;
}
changeTrack->pan = pan * 1000;
@ -202,7 +202,7 @@ int Imuse::getVolume(const char *soundName) {
getTrack = findTrack(soundName);
if (getTrack == NULL) {
warning("Unable to find track '%s' to get volume!", soundName);
warning("Unable to find track '%s' to get volume", soundName);
return 0;
}
return getTrack->vol / 1000;
@ -214,7 +214,7 @@ void Imuse::setHookId(const char *soundName, int hookId) {
changeTrack = findTrack(soundName);
if (changeTrack == NULL) {
warning("Unable to find track '%s' to change hook id!", soundName);
warning("Unable to find track '%s' to change hook id", soundName);
return;
}
changeTrack->curHookId = hookId;
@ -244,7 +244,7 @@ void Imuse::selectVolumeGroup(const char *soundName, int volGroupId) {
changeTrack = findTrack(soundName);
if (changeTrack == NULL) {
warning("Unable to find track '%s' to change volume group id!", soundName);
warning("Unable to find track '%s' to change volume group id", soundName);
return;
}
changeTrack->volGroupId = volGroupId;
@ -256,7 +256,7 @@ void Imuse::setFadeVolume(const char *soundName, int destVolume, int duration) {
changeTrack = findTrack(soundName);
if (changeTrack == NULL) {
warning("Unable to find track '%s' to change fade volume!", soundName);
warning("Unable to find track '%s' to change fade volume", soundName);
return;
}
changeTrack->volFadeDelay = duration;
@ -271,7 +271,7 @@ void Imuse::setFadePan(const char *soundName, int destPan, int duration) {
changeTrack = findTrack(soundName);
if (changeTrack == NULL) {
warning("Unable to find track '%s' to change fade pan!", soundName);
warning("Unable to find track '%s' to change fade pan", soundName);
return;
}
changeTrack->panFadeDelay = duration;

View File

@ -51,7 +51,7 @@ Localizer::Localizer() {
break;
}
if (!f.isOpen()) {
error("Localizer::Localizer: Unable to find localization information (grim.tab)!");
error("Localizer::Localizer: Unable to find localization information (grim.tab)");
return;
}

View File

@ -2178,7 +2178,7 @@ static void MakeSectorActive() {
// FIXME: This happens on initial load. Are we initting something in the wrong order?
if (!g_grim->currScene()) {
warning("!!!! Trying to call MakeSectorActive without a scene!");
warning("!!!! Trying to call MakeSectorActive without a scene");
return;
}
@ -2283,7 +2283,7 @@ static void GetCurrentSetup() {
// FIXME there are some big difference here !
Scene *scene = g_grim->findScene(name);
if (!scene) {
warning("GetCurrentSetup() Requested scene (%s) is not loaded!", name);
warning("GetCurrentSetup() Requested scene (%s) is not loaded", name);
lua_pushnil();
return;
}
@ -3501,7 +3501,7 @@ static void GetSaveGameImage() {
lua_pushusertag(screenshot, MKID_BE('VBUF'));
} else {
lua_pushnil();
warning("Could not restore screenshot from file!");
warning("Could not restore screenshot from file");
return;
}
savedState->endSection();
@ -3516,7 +3516,7 @@ static void SubmitSaveGameData() {
savedState = g_grim->savedState();
if (!savedState)
error("Cannot obtain saved game!");
error("Cannot obtain saved game");
savedState->beginSection('SUBS');
int count = 0;
for (;;) {
@ -4463,7 +4463,7 @@ lua_Object getTableValue(lua_Object table, const char *name) {
lua_Object key = LUA_NOOBJECT;
if (!lua_istable(table)) {
error("getTableValue(): Parameter not a table!");
error("getTableValue(): Parameter not a table");
return 0;
}
@ -4478,7 +4478,7 @@ lua_Object getTableValue(lua_Object table, const char *name) {
// that it doesn't understand then an infinite loop
// will be set up repeating the same error.
if (lua_call("next") != 0) {
error("getTableValue could not find the next key!");
error("getTableValue could not find the next key");
return 0;
}
key = lua_getresult(1);

View File

@ -74,7 +74,7 @@ SaveGame::~SaveGame() {
uint32 SaveGame::beginSection(uint32 sectionTag) {
if (_currentSection != 0)
error("Tried to begin a new save game section with ending old section!");
error("Tried to begin a new save game section with ending old section");
_currentSection = sectionTag;
_sectionSize = 0;
_sectionBuffer = (byte *)malloc(_sectionSize);
@ -85,7 +85,7 @@ uint32 SaveGame::beginSection(uint32 sectionTag) {
free(_sectionBuffer);
tag = _inSaveFile->readUint32BE();
if (tag == SAVEGAME_FOOTERTAG)
error("Unable to find requested section of savegame!");
error("Unable to find requested section of savegame");
_sectionSize = _inSaveFile->readUint32BE();
_sectionBuffer = (byte *)malloc(_sectionSize);
_inSaveFile->read(_sectionBuffer, _sectionSize);
@ -97,7 +97,7 @@ uint32 SaveGame::beginSection(uint32 sectionTag) {
void SaveGame::endSection() {
if (_currentSection == 0)
error("Tried to end a save game section without starting a section!");
error("Tried to end a save game section without starting a section");
if (_saving) {
_outSaveFile->writeUint32BE(_currentSection);
_outSaveFile->writeUint32BE(_sectionSize);
@ -117,18 +117,18 @@ uint32 SaveGame::getBufferPos() {
void SaveGame::read(void *data, int size) {
if (_saving)
error("SaveGame::readBlock called when storing a savegame!");
error("SaveGame::readBlock called when storing a savegame");
if (_currentSection == 0)
error("Tried to read a block without starting a section!");
error("Tried to read a block without starting a section");
memcpy(data, &_sectionBuffer[_sectionPtr], size);
_sectionPtr += size;
}
uint32 SaveGame::readLEUint32() {
if (_saving)
error("SaveGame::readBlock called when storing a savegame!");
error("SaveGame::readBlock called when storing a savegame");
if (_currentSection == 0)
error("Tried to read a block without starting a section!");
error("Tried to read a block without starting a section");
uint32 data = READ_LE_UINT32(&_sectionBuffer[_sectionPtr]);
_sectionPtr += 4;
return data;
@ -136,9 +136,9 @@ uint32 SaveGame::readLEUint32() {
int32 SaveGame::readLESint32() {
if (_saving)
error("SaveGame::readBlock called when storing a savegame!");
error("SaveGame::readBlock called when storing a savegame");
if (_currentSection == 0)
error("Tried to read a block without starting a section!");
error("Tried to read a block without starting a section");
int32 data = (int32)READ_LE_UINT32(&_sectionBuffer[_sectionPtr]);
_sectionPtr += 4;
return data;
@ -146,9 +146,9 @@ int32 SaveGame::readLESint32() {
byte SaveGame::readByte() {
if (_saving)
error("SaveGame::readBlock called when storing a savegame!");
error("SaveGame::readBlock called when storing a savegame");
if (_currentSection == 0)
error("Tried to read a block without starting a section!");
error("Tried to read a block without starting a section");
byte data = _sectionBuffer[_sectionPtr];
_sectionPtr++;
return data;
@ -156,9 +156,9 @@ byte SaveGame::readByte() {
bool SaveGame::readLEBool() {
if (_saving)
error("SaveGame::readBlock called when storing a savegame!");
error("SaveGame::readBlock called when storing a savegame");
if (_currentSection == 0)
error("Tried to read a block without starting a section!");
error("Tried to read a block without starting a section");
uint32 data = READ_LE_UINT32(&_sectionBuffer[_sectionPtr]);
_sectionPtr += 4;
return data != 0;
@ -166,24 +166,24 @@ bool SaveGame::readLEBool() {
void SaveGame::write(const void *data, int size) {
if (!_saving)
error("SaveGame::writeBlock called when restoring a savegame!");
error("SaveGame::writeBlock called when restoring a savegame");
if (_currentSection == 0)
error("Tried to write a block without starting a section!");
error("Tried to write a block without starting a section");
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + size);
if (!_sectionBuffer)
error("Failed to allocate space for buffer!");
error("Failed to allocate space for buffer");
memcpy(&_sectionBuffer[_sectionSize], data, size);
_sectionSize += size;
}
void SaveGame::writeLEUint32(uint32 data) {
if (!_saving)
error("SaveGame::writeBlock called when restoring a savegame!");
error("SaveGame::writeBlock called when restoring a savegame");
if (_currentSection == 0)
error("Tried to write a block without starting a section!");
error("Tried to write a block without starting a section");
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 4);
if (!_sectionBuffer)
error("Failed to allocate space for buffer!");
error("Failed to allocate space for buffer");
WRITE_LE_UINT32(&_sectionBuffer[_sectionSize], data);
_sectionSize += 4;
@ -191,12 +191,12 @@ void SaveGame::writeLEUint32(uint32 data) {
void SaveGame::writeLESint32(int32 data) {
if (!_saving)
error("SaveGame::writeBlock called when restoring a savegame!");
error("SaveGame::writeBlock called when restoring a savegame");
if (_currentSection == 0)
error("Tried to write a block without starting a section!");
error("Tried to write a block without starting a section");
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 4);
if (!_sectionBuffer)
error("Failed to allocate space for buffer!");
error("Failed to allocate space for buffer");
WRITE_LE_UINT32(&_sectionBuffer[_sectionSize], (uint32)data);
_sectionSize += 4;
@ -204,12 +204,12 @@ void SaveGame::writeLESint32(int32 data) {
void SaveGame::writeLEBool(bool data) {
if (!_saving)
error("SaveGame::writeBlock called when restoring a savegame!");
error("SaveGame::writeBlock called when restoring a savegame");
if (_currentSection == 0)
error("Tried to write a block without starting a section!");
error("Tried to write a block without starting a section");
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 4);
if (!_sectionBuffer)
error("Failed to allocate space for buffer!");
error("Failed to allocate space for buffer");
WRITE_LE_UINT32(&_sectionBuffer[_sectionSize], (uint32)data);
_sectionSize += 4;
@ -217,12 +217,12 @@ void SaveGame::writeLEBool(bool data) {
void SaveGame::writeByte(byte data) {
if (!_saving)
error("SaveGame::writeBlock called when restoring a savegame!");
error("SaveGame::writeBlock called when restoring a savegame");
if (_currentSection == 0)
error("Tried to write a block without starting a section!");
error("Tried to write a block without starting a section");
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 1);
if (!_sectionBuffer)
error("Failed to allocate space for buffer!");
error("Failed to allocate space for buffer");
_sectionBuffer[_sectionSize] = data;
_sectionSize++;

View File

@ -208,7 +208,7 @@ void Scene::setSetup(int num) {
// Looks like num is zero-based so >= should work to find values
// that are out of the range of valid setups
if (num >= _numSetups || num < 0) {
error("Failed to change scene setup, value out of range!");
error("Failed to change scene setup, value out of range");
return;
}
_currSetup = _setups + num;
@ -265,7 +265,7 @@ ObjectState *Scene::findState(const char *filename) {
return *i;
if (strcasecmp(file, filename) == 0) {
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("State object request '%s' matches object '%s' but is the wrong case!", filename, file);
warning("State object request '%s' matches object '%s' but is the wrong case", filename, file);
return *i;
}
}

View File

@ -343,7 +343,7 @@ struct SavePos *zlibFile::getPos() {
if (position == ((uint32) -1)) {
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("zlibFile::open() unable to find start position!");
warning("zlibFile::open() unable to find start position");
return NULL;
}
pos = new SavePos;
@ -356,21 +356,21 @@ struct SavePos *zlibFile::getPos() {
bool zlibFile::setPos(struct SavePos *pos) {
if (!pos) {
warning("Unable to rewind SMUSH movie (no position passed)!");
warning("Unable to rewind SMUSH movie (no position passed)");
return false;
}
if (!_handle || !_handle->isOpen()) {
warning("Unable to rewind SMUSH movie (invalid handle)!");
warning("Unable to rewind SMUSH movie (invalid handle)");
return false;
}
_handle->seek(pos->filePos, SEEK_SET);
if (_handle->ioFailed()) {
warning("Unable to rewind SMUSH movie (seek failed)!");
warning("Unable to rewind SMUSH movie (seek failed)");
return false;
}
memcpy(_inBuf, pos->tmpBuf, BUFFER_SIZE);
if (inflateCopy(&_stream, &pos->streamBuf) != Z_OK) {
warning("Unable to rewind SMUSH movie (z-lib copy handle failed)!");
warning("Unable to rewind SMUSH movie (z-lib copy handle failed)");
return false;
}
_fileDone = false;
@ -459,7 +459,7 @@ uint32 zlibFile::read(void *ptr, uint32 len) {
if (!_handle->isOpen()) {
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("zlibFile::read() File is not open!");
error("zlibFile::read() File is not open");
return 0;
}

View File

@ -250,7 +250,7 @@ void TextObject::draw() {
g_driver->drawTextBitmap(x, height + y, _textObjectHandle[i]);
} else if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("TextObject::draw: Unknown justification code (%d)!", _justify);
warning("TextObject::draw: Unknown justification code (%d)", _justify);
height += _font->getHeight();
}