Checking for more required variables.

Trying to use trackstop without ui or world results in a hard crash.
develop
Eric Wald 2014-09-28 21:34:42 -06:00
parent 11d08518d6
commit 4af9b7a054
1 changed files with 5 additions and 2 deletions

@ -169,8 +169,11 @@ IMPLEMENT_VMETHOD_INTERPOSE(trackstop_hook, render);
DFhackCExport command_result plugin_enable(color_ostream& out, bool enable) {
// Accept the "enable trackstop" / "disable trackstop" commands.
if (enable != enabled) {
if (enable && !gps) {
out.printerr("The trackstop module needs graphics.\n");
// Check for global variables that, if missing, result in total failure.
// Missing enabler and ui_menu_width also produce visible effects, but not nearly as severe.
// This could be moved to the plugin_init step, but that's louder for no real benefit.
if (!(gps && ui && world)) {
out.printerr("trackstop: Missing required global variables.\n");
return CR_FAILURE;
}