From 6a51e39a5c57ef94b108f6c562c2503b9e88668c Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sun, 10 Jul 2022 11:55:56 +0200 Subject: [PATCH] Print error if reverse() fails to open a file --- src/gfx/reverse.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gfx/reverse.cpp b/src/gfx/reverse.cpp index 5549d4bc..40e4b5ae 100644 --- a/src/gfx/reverse.cpp +++ b/src/gfx/reverse.cpp @@ -28,7 +28,9 @@ static DefaultInitVec readInto(std::string path) { std::filebuf file; - file.open(path, std::ios::in | std::ios::binary); + if (!file.open(path, std::ios::in | std::ios::binary)) { + fatal("Failed to open \"%s\": %s", path.c_str(), strerror(errno)); + } DefaultInitVec data(128 * 16); // Begin with some room pre-allocated size_t curSize = 0; @@ -117,6 +119,7 @@ void reverse() { if (!options.tilemap.empty()) { tilemap = readInto(options.tilemap); nbTileInstances = tilemap->size(); + options.verbosePrint(Options::VERB_INTERM, "Read %zu tilemap entries.\n", nbTileInstances); } if (nbTileInstances > options.maxNbTiles[0] + options.maxNbTiles[1]) {