From 4af9b7a0546f30583d979011d13f7c969bfdf108 Mon Sep 17 00:00:00 2001 From: Eric Wald Date: Sun, 28 Sep 2014 21:34:42 -0600 Subject: [PATCH] Checking for more required variables. Trying to use trackstop without ui or world results in a hard crash. --- plugins/trackstop.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/trackstop.cpp b/plugins/trackstop.cpp index 54e0b56d4..455b53774 100644 --- a/plugins/trackstop.cpp +++ b/plugins/trackstop.cpp @@ -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; }