aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
authorPaul Gilbert2019-02-19 19:51:15 -0800
committerPaul Gilbert2019-02-19 19:51:15 -0800
commitc42e2a3243838d717e8a17387bbecb830a92415b (patch)
treeac13e64f1c637f569c33dd2a89d96c398a2091af /engines/glk
parentd6e7ea794d97e0525615939a935ea952c74b03e1 (diff)
downloadscummvm-rg350-c42e2a3243838d717e8a17387bbecb830a92415b.tar.gz
scummvm-rg350-c42e2a3243838d717e8a17387bbecb830a92415b.tar.bz2
scummvm-rg350-c42e2a3243838d717e8a17387bbecb830a92415b.zip
GLK: Better error messages for failing to load fonts
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/screen.cpp12
-rw-r--r--engines/glk/screen.h2
2 files changed, 6 insertions, 8 deletions
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