From 1799c4f04507e46f30d8321447061a7f93d5dcda Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Mon, 31 Jan 2011 18:22:20 +0000 Subject: Hugo: Some cleanup svn-id: r55690 --- engines/hugo/file.cpp | 8 ++++---- engines/hugo/file.h | 4 ++-- engines/hugo/file_v1d.cpp | 2 +- engines/hugo/hugo.cpp | 12 ++++++------ engines/hugo/parser.cpp | 7 +++---- engines/hugo/schedule.cpp | 4 ++-- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 0c330d3ed7..b6b34da592 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -171,9 +171,9 @@ void FileManager::readImage(int objNum, object_t *objPtr) { _objectsArchive.seek(objBlock.objOffset, SEEK_SET); } else { Common::String buf; - buf = _vm->_picDir + Common::String(_vm->_text->getNoun(objPtr->nounIndex, 0)) + Common::String(".PIX"); + buf = _vm->_picDir + Common::String(_vm->_text->getNoun(objPtr->nounIndex, 0)) + ".PIX"; if (!_objectsArchive.open(buf)) { - buf = Common::String(_vm->_text->getNoun(objPtr->nounIndex, 0)) + Common::String(".PIX"); + buf = Common::String(_vm->_text->getNoun(objPtr->nounIndex, 0)) + ".PIX"; if (!_objectsArchive.open(buf)) error("File not found: %s", buf.c_str()); } @@ -292,7 +292,7 @@ sound_pt FileManager::getSound(int16 sound, uint16 *size) { /** * Return whether file exists or not */ -bool FileManager::fileExists(Common::String filename) { +bool FileManager::fileExists(const Common::String filename) const { Common::File f; return(f.exists(filename)); } @@ -300,7 +300,7 @@ bool FileManager::fileExists(Common::String filename) { /** * Save game to supplied slot */ -bool FileManager::saveGame(int16 slot, Common::String descrip) { +bool FileManager::saveGame(int16 slot, const Common::String descrip) { debugC(1, kDebugFile, "saveGame(%d, %s)", slot, descrip.c_str()); const EnginePlugin *plugin = NULL; diff --git a/engines/hugo/file.h b/engines/hugo/file.h index 3920fd66f6..5788298edc 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -44,7 +44,7 @@ public: FileManager(HugoEngine *vm); virtual ~FileManager(); - bool fileExists(Common::String filename); + bool fileExists(const Common::String filename) const; sound_pt getSound(int16 sound, uint16 *size); void readBootFile(); @@ -52,7 +52,7 @@ public: void readUIFImages(); void readUIFItem(int16 id, byte *buf); bool restoreGame(int16 slot); - bool saveGame(int16 slot, Common::String descrip); + bool saveGame(int16 slot, const Common::String descrip); // Name scenery and objects picture databases const char *getBootFilename() { return "HUGO.BSF"; } diff --git a/engines/hugo/file_v1d.cpp b/engines/hugo/file_v1d.cpp index 8a07518a13..964887fc34 100644 --- a/engines/hugo/file_v1d.cpp +++ b/engines/hugo/file_v1d.cpp @@ -85,7 +85,7 @@ void FileManager_v1d::readBackground(int screenIndex) { debugC(1, kDebugFile, "readBackground(%d)", screenIndex); Common::String buf; - buf = Common::String(_vm->_text->getScreenNames(screenIndex)) + Common::String(".ART"); + buf = Common::String(_vm->_text->getScreenNames(screenIndex)) + ".ART"; if (!_sceneryArchive1.open(buf)) error("File not found: %s", buf.c_str()); // Read the image into dummy seq and static dib_a diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 1bc408fb14..eeeb915401 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -826,27 +826,27 @@ void HugoEngine::initialize() { switch (_gameVariant) { case kGameVariantH1Dos: _episode = "\"Hugo's House of Horrors\""; - _picDir = Common::String(""); + _picDir = ""; break; case kGameVariantH2Dos: _episode = "\"Hugo II: Whodunit?\""; - _picDir = Common::String(""); + _picDir = ""; break; case kGameVariantH3Dos: _episode = "\"Hugo III: Jungle of Doom\""; - _picDir = Common::String("pictures/"); + _picDir = "pictures/"; break; case kGameVariantH1Win: _episode = "\"Hugo's Horrific Adventure\""; - _picDir = Common::String("hugo1/"); + _picDir = "hugo1/"; break; case kGameVariantH2Win: _episode = "\"Hugo's Mystery Adventure\""; - _picDir = Common::String("hugo2/"); + _picDir = "hugo2/"; break; case kGameVariantH3Win: _episode = "\"Hugo's Amazon Adventure\""; - _picDir = Common::String("hugo3/"); + _picDir = "hugo3/"; break; default: error("Unknown game"); diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index fcaa80d21c..d3d8815c04 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -320,7 +320,6 @@ void Parser::showDosInventory() { for (int i = 0; i < _vm->_object->_numObj; i++) { // Find widths of 2 columns if (_vm->_object->isCarried(i)) { uint16 len = strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)); - printf("%s %d\n", _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2), strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2))); if (index++ & 1) // Right hand column len2 = (len > len2) ? len : len2; else @@ -336,18 +335,18 @@ void Parser::showDosInventory() { assert(len1 + len2 - strlen(_vm->_text->getTextParser(kTBIntro)) / 2 < strlen(blanks)); buffer = Common::String(blanks, (len1 + len2 - strlen(_vm->_text->getTextParser(kTBIntro))) / 2); - buffer += Common::String(_vm->_text->getTextParser(kTBIntro)) + Common::String("\n"); + buffer += Common::String(_vm->_text->getTextParser(kTBIntro)) + "\n"; index = 0; for (int i = 0; i < _vm->_object->_numObj; i++) { // Assign strings if (_vm->_object->isCarried(i)) { if (index++ & 1) - buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + Common::String("\n"); + buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + "\n"; else buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + Common::String(blanks, len1 - strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2))); } } if (index & 1) - buffer += Common::String("\n"); + buffer += "\n"; buffer += Common::String(_vm->_text->getTextParser(kTBOutro)); Utils::Box(kBoxAny, "%s", buffer.c_str()); } diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index a723871f02..832297e7e5 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -163,8 +163,8 @@ void Scheduler::newScreen(int screenIndex) { // Make sure the background file exists! if (!_vm->isPacked()) { Common::String filename = Common::String(_vm->_text->getScreenNames(screenIndex)); - if (!_vm->_file->fileExists(_vm->_picDir + filename + Common::String(".PCX")) && - !_vm->_file->fileExists(filename + Common::String(".ART"))) { + if (!_vm->_file->fileExists(_vm->_picDir + filename + ".PCX") && + !_vm->_file->fileExists(filename + ".ART")) { error("Unable to find background file for %s", filename.c_str()); return; } -- cgit v1.2.3