Lua Console: Print an error message when not opening the console because :debug hasn't been run.

(cherry-picked from commit 012142a3c6)
This commit is contained in:
josteph 2018-08-25 21:54:21 +00:00 committed by Pentarctagon
parent f761493c75
commit 5301d0714a

View file

@ -30,6 +30,7 @@
#include "game_config.hpp"
#include "game_errors.hpp"
#include "gettext.hpp"
#include "play_controller.hpp"
#include "resources.hpp" //for help fetching lua kernel pointers
#include "scripting/plugins/manager.hpp" //needed for the WHICH_KERNEL version of display
#include "scripting/game_lua_kernel.hpp" //needed for the WHICH_KERNEL version of display
@ -685,6 +686,9 @@ void lua_interpreter::controller::search(int direction)
void lua_interpreter::display(lua_kernel_base * lk) {
#ifndef ALWAYS_HAVE_LUA_CONSOLE
if(!game_config::debug) {
display_chat_manager& chat_man = resources::controller->get_display().get_chat_manager();
const std::string& message = _("The lua console can only be used in debug mode! (Run ':debug' first)");
chat_man.add_chat_message(time(nullptr), _("lua console"), 0, message, events::chat_handler::MESSAGE_PRIVATE, false);
return;
}
#endif