diff options
author | Strangerke | 2019-09-01 20:04:27 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-13 22:07:08 +0100 |
commit | e313bc167d13e05f027d7e7832d97ccaacbb7d88 (patch) | |
tree | 3d9b6777cb5815aad50a666c38d5aa72701a5072 /engines | |
parent | daa06c0c7d59690ae3e74aa73848265049c00c77 (diff) | |
download | scummvm-rg350-e313bc167d13e05f027d7e7832d97ccaacbb7d88.tar.gz scummvm-rg350-e313bc167d13e05f027d7e7832d97ccaacbb7d88.tar.bz2 scummvm-rg350-e313bc167d13e05f027d7e7832d97ccaacbb7d88.zip |
GRIFFON: Add a check after calls to file.open
Diffstat (limited to 'engines')
-rw-r--r-- | engines/griffon/config.h | 2 | ||||
-rw-r--r-- | engines/griffon/engine.cpp | 27 | ||||
-rw-r--r-- | engines/griffon/saveload.cpp | 2 |
3 files changed, 21 insertions, 10 deletions
diff --git a/engines/griffon/config.h b/engines/griffon/config.h index 0b6ec89dfc..187ff2823a 100644 --- a/engines/griffon/config.h +++ b/engines/griffon/config.h @@ -45,7 +45,7 @@ struct CONFIG { int scr_bpp; bool fullscreen; int hwaccel; - int hwsurface; + int hwsurface; // Unused bool music; int musicvol; bool effects; diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp index 01021e02ac..7d418e2707 100644 --- a/engines/griffon/engine.cpp +++ b/engines/griffon/engine.cpp @@ -155,9 +155,8 @@ DataChunk *Mix_LoadWAV(const char *name) { DataChunk *res = new DataChunk; file.open(name); - if (!file.isOpen()) { + if (!file.isOpen()) error("Cannot open file %s", name); - } res->size = file.size(); res->data = (byte *)malloc(res->size); @@ -3681,18 +3680,20 @@ void GriffonEngine::game_loadmap(int mapnum) { Common::File file; file.open(name); + + if (!file.isOpen()) + error("Cannot open file %s", name); + int tempmap[320][200]; for (int x = 0; x <= 319; x++) { - for (int y = 0; y <= 199; y++) { + for (int y = 0; y <= 199; y++) INPUT("%i", &tempmap[x][y]); - } } file.close(); for (int x = 0; x <= 319; x++) { - for (int y = 0; y <= 239; y++) { + for (int y = 0; y <= 239; y++) _triggerloc[x][y] = -1; - } } // read *.trg file @@ -3700,6 +3701,9 @@ void GriffonEngine::game_loadmap(int mapnum) { debug(1, "Reading %s", name); file.open(name); + if (!file.isOpen()) + error("Cannot open file %s", name); + INPUT("%i", &_ntriggers); for (int i = 0; i < _ntriggers; i++) { @@ -3945,6 +3949,9 @@ void GriffonEngine::game_loadmap(int mapnum) { debug(1, "Reading %s", name); file.open(name); + if (!file.isOpen()) + error("Cannot open file %s", name); + for (int i = 0; i < kMaxNPC; i++) { INPUT("%i", &_npcinfo[i].spriteset); INPUT("%i", &_npcinfo[i].x1); @@ -8007,10 +8014,12 @@ void GriffonEngine::sys_LoadTriggers() { Common::File file; file.open("data/triggers.dat"); + if (!file.isOpen()) + error("Cannot open file data/Triggers.dat"); + for (int i = 0; i <= 9999; i++) { - for (int a = 0; a <= 8; a++) { + for (int a = 0; a <= 8; a++) INPUT("%i", &_triggers[i][a]); - } } file.close(); @@ -8020,6 +8029,8 @@ void GriffonEngine::sys_LoadObjectDB() { Common::File file; file.open("objectdb.dat"); + if (!file.isOpen()) + error("Cannot open file objectdb.dat"); for (int a = 0; a <= 32; a++) { for (int b = 0; b <= 5; b++) { diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp index 2ff71d00ae..f0911fceed 100644 --- a/engines/griffon/saveload.cpp +++ b/engines/griffon/saveload.cpp @@ -125,7 +125,7 @@ int GriffonEngine::state_load(int slotnum) { return 1; // success } - return 0; // faliure + return 0; // failure } /* fill PLAYERTYPE _playera; */ |