diff --git a/sword1/music.cpp b/sword1/music.cpp index c002aed40d0..911cfceb1d3 100644 --- a/sword1/music.cpp +++ b/sword1/music.cpp @@ -85,8 +85,7 @@ int MusicHandle::readBuffer(int16 *buffer, const int numSamples) { bool MusicHandle::play(const char *filename, bool loop) { uint8 wavHeader[WAVEHEADERSIZE]; stop(); - _file.open(filename); - if (!_file.isOpen()) { + if (!_file.open(filename)) { warning("Music file %s could not be opened", filename); return false; } diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 5dbf75d49fd..dc1666d6734 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -699,8 +699,7 @@ uint32 Sound::preFetchCompSpeech(const char *filename, uint32 speechid, uint16 * *buf = NULL; // Open the speech cluster and find the data offset & size - fp.open(filename); - if (!fp.isOpen()) + if (!fp.open(filename)) return 0; fp.seek((speechid + 1) * 8, SEEK_SET); diff --git a/sword2/function.cpp b/sword2/function.cpp index fbde8e44d37..ea4a89b5842 100644 --- a/sword2/function.cpp +++ b/sword2/function.cpp @@ -446,14 +446,12 @@ int32 Logic::fnPlayCredits(int32 *params) { // Read the "Smacker" logo - f.open("credits.bmp"); - uint16 logoWidth = 0; uint16 logoHeight = 0; uint8 *logoData = NULL; uint8 palette[1024]; - if (f.isOpen()) { + if (f.open("credits.bmp")) { logoWidth = f.readUint16LE(); logoHeight = f.readUint16LE(); @@ -491,8 +489,7 @@ int32 Logic::fnPlayCredits(int32 *params) { char textLine[80]; - f.open("credits.clu"); - if (!f.isOpen()) { + if (!f.open("credits.clu")) { warning("Can't find credits.clu"); return IR_CONT; } diff --git a/sword2/resman.cpp b/sword2/resman.cpp index 7718f9426e8..ee0162aa98a 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -521,11 +521,8 @@ uint8 *ResourceManager::openResource(uint32 res, bool dump) { sprintf(buf, "dumps/%s-%d.dmp", tag, res); #endif - out.open(buf, ""); - - if (!out.isOpen()) { - out.open(buf, "", File::kFileWriteMode); - if (out.isOpen()) + if (!out.open(buf, "")) { + if (out.open(buf, "", File::kFileWriteMode)) out.write(_resList[res]->ad, len); }