From 14f1e6b06c8e74d6314ed55d39ccc9235e599245 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 22 Dec 2015 19:34:54 -0500 Subject: [PATCH] Improve prerelease warning somewhat --- library/Core.cpp | 2 +- scripts/gui/prerelease-warning.lua | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/library/Core.cpp b/library/Core.cpp index bdbb5c3b2..e58db7755 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -2057,7 +2057,7 @@ void Core::onStateChange(color_ostream &out, state_change_event event) break; } - if (event == SC_MAP_LOADED && Version::is_prerelease()) + if (event == SC_WORLD_LOADED && Version::is_prerelease()) { runCommand(out, "gui/prerelease-warning"); std::cerr << "loaded map in prerelease build" << std::endl; diff --git a/scripts/gui/prerelease-warning.lua b/scripts/gui/prerelease-warning.lua index 53d612d41..a065e5224 100644 --- a/scripts/gui/prerelease-warning.lua +++ b/scripts/gui/prerelease-warning.lua @@ -11,13 +11,26 @@ if not dfhack.isPrerelease() then qerror('not a prerelease build') end local gui = require 'gui' local dlg = require 'gui.dialogs' +local utils = require 'utils' local message = { 'This is a prerelease build of DFHack. Some structures are likely', NEWLINE, 'to be incorrect, resulting in crashes or save corruption', NEWLINE, - {pen=COLOR_LIGHTRED, text='Make backups of your saves and avoid saving if possible.'} + {pen=COLOR_LIGHTRED, text='Make backups of your saves and avoid saving if possible.'}, NEWLINE, } +path = dfhack.getHackPath():lower() +if path:find('lnp') or path:find('starter') or path:find('newb') or path:find('lazy') or path:find('pack') then + local pack_msg = [[ +Under no circumstances should this be enabled by default in a pack. +If you are seeing this message and did not enable DFHack yourself, +please report this to your pack's maintainer.]] + for _, v in pairs(utils.split_string(pack_msg, '\n')) do + table.insert(message, NEWLINE) + table.insert(message, {text=v, pen=COLOR_LIGHTMAGENTA}) + end +end + dfhack.print('\n') for k,v in ipairs(message) do