LAB: Add some feedback when a file isn't found
This commit is contained in:
parent
d96484d81c
commit
18fc6fd102
3 changed files with 13 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue