Skip to content

Commit

Permalink
Suggest checking the data dir path when unable to initialize fonts
Browse files Browse the repository at this point in the history
Not being able to initialize fonts is usually the direct consequence of
a failure to read data/hardwired/fonts.cfg, possibly because the game
data dir was incorrectly set or detected. Thus, it's the ideal point
during early initialization to provide a hint on stderr for players.

I specifically avoided mentioning anything about "installing" the game
so as to not contribute to the common misconception that the game needs
to be installed to run.
  • Loading branch information
irydacea committed Jun 13, 2014
1 parent 51f395e commit 170bd82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog
Expand Up @@ -53,6 +53,8 @@ Version 1.11.15+dev:
* Fix bug #22147: Assertion error when a network error is thrown during the game.
* Removed the YetAnotherMapGenerator (not finished)
* Fix bug #22134: Campaign prefix not used in mp campaign saves
* Made the error messages sent to stderr when the core data dir is
incorrectly set more helpful.

Version 1.11.15:
* Graphics:
Expand Down
10 changes: 10 additions & 0 deletions src/game.cpp
Expand Up @@ -414,6 +414,15 @@ static void init_locale() {
textdomain (PACKAGE);
}

static void warn_early_init_failure()
{
// NOTE: wrap output to 80 columns.
std::cerr << '\n'
<< "An error at this point during initialization usually indicates that the data\n"
<< "directory above was not correctly set or detected. Try passing the correct path\n"
<< "in the command line with the --config-dir switch or as the only argument.\n";
}

/**
* Setups the game environment and enters
* the titlescreen or game loops.
Expand Down Expand Up @@ -443,6 +452,7 @@ static int do_gameloop(int argc, char** argv)
res = font::load_font_config();
if(res == false) {
std::cerr << "could not initialize fonts\n";
warn_early_init_failure();
return 1;
}

Expand Down

0 comments on commit 170bd82

Please sign in to comment.