LAB: Add some feedback when a file isn't found

This commit is contained in:
Strangerke 2015-11-29 21:54:19 +01:00 committed by Willem Jan Palenstijn
parent d96484d81c
commit 18fc6fd102
3 changed files with 13 additions and 1 deletions

View file

@ -230,6 +230,9 @@ bool LabEngine::setUpScreens() {
/* Loads in the graphics for the movement control panel */
Common::File file;
file.open(translateFileName("P:Control"));
if (!file.isOpen())
warning("setUpScreens couldn't open %s", translateFileName("P:Control"));
if (file.err() || file.size() == 0)
return false;
@ -290,6 +293,9 @@ bool LabEngine::setUpScreens() {
}
file.open(translateFileName("P:Inv"));
if (!file.isOpen())
warning("setUpScreens couldn't open %s", translateFileName("P:Inv"));
if (file.err() || file.size() == 0)
return false;

View file

@ -289,6 +289,7 @@ Common::File *openPartial(const char *name) {
f->open(translateFileName(name));
if (!f->isOpen()) {
warning("openPartial skipped %s", translateFileName(name));
delete f;
return 0;
}

View file

@ -48,6 +48,8 @@ Resource::Resource() {
void Resource::readStaticText() {
Common::File labTextFile;
labTextFile.open(translateFileName("Lab:Rooms/LabText"));
if (!labTextFile.isOpen())
error("Unable to open file %s (Lab:Rooms/LabText)", translateFileName("Lab:Rooms/LabText"));
for (int i = 0; i < 48; i++)
_staticText[i] = labTextFile.readLine();
@ -151,9 +153,12 @@ bool Resource::readViews(uint16 roomNum) {
Common::File *Resource::openDataFile(const char *fileName, uint32 fileHeader) {
Common::File *dataFile = new Common::File();
dataFile->open(translateFileName(fileName));
if (!dataFile->isOpen())
error("openDataFile couldn't open %s (%s)", translateFileName(fileName), fileName);
if (dataFile->readUint32BE() != fileHeader) {
dataFile->close();
return NULL;
return nullptr;
}
return dataFile;