From c42e2a3243838d717e8a17387bbecb830a92415b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 19 Feb 2019 19:51:15 -0800 Subject: GLK: Better error messages for failing to load fonts --- engines/glk/screen.cpp | 12 +++++------- engines/glk/screen.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'engines/glk') diff --git a/engines/glk/screen.cpp b/engines/glk/screen.cpp index c460a216f1..df2a288c1a 100644 --- a/engines/glk/screen.cpp +++ b/engines/glk/screen.cpp @@ -39,8 +39,7 @@ Screen::~Screen() { } void Screen::initialize() { - if (!loadFonts()) - error("Could not load fonts.dat"); + loadFonts(); for (int idx = 0; idx < 2; ++idx) { FontInfo *i = (idx == 0) ? &g_conf->_monoInfo : &g_conf->_propInfo; @@ -68,17 +67,17 @@ void Screen::fillRect(const Rect &box, uint color) { Graphics::Screen::fillRect(box, color); } -bool Screen::loadFonts() { +void Screen::loadFonts() { Common::Archive *archive = nullptr; if (!Common::File::exists(FONTS_FILENAME) || (archive = Common::makeZipArchive(FONTS_FILENAME)) == nullptr) - return false; + error("Could not locate %s", FONTS_FILENAME); // Open the version.txt file within it to validate the version Common::File f; if (!f.open("version.txt", *archive)) { delete archive; - return false; + error("Could not get version of fonts data. Possibly malformed"); } // Validate the version @@ -89,13 +88,12 @@ bool Screen::loadFonts() { double version = atof(buffer); if (version < 1.2) { delete archive; - return false; + error("Out of date fonts. Expected at least %f, but got version %f", 1.2, version); } loadFonts(archive); delete archive; - return true; } void Screen::loadFonts(Common::Archive *archive) { diff --git a/engines/glk/screen.h b/engines/glk/screen.h index 34192d1e75..031e58f6e5 100644 --- a/engines/glk/screen.h +++ b/engines/glk/screen.h @@ -46,7 +46,7 @@ private: /** * Open the fonts archive and load all the fonts */ - bool loadFonts(); + void loadFonts(); /** * Load a single font -- cgit v1.2.3