From a516811bb1e6e7efe88ecd06b567df89162cfa0f Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 13 May 2014 16:41:55 -0400 Subject: [PATCH 1/4] Only allow 3dveins to be run in fortress mode Prevents crash from running in arena mode --- plugins/3dveins.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/3dveins.cpp b/plugins/3dveins.cpp index 432d93cf6..c9e15aae5 100644 --- a/plugins/3dveins.cpp +++ b/plugins/3dveins.cpp @@ -42,6 +42,7 @@ using namespace MapExtras; using namespace DFHack::Random; using df::global::world; +using df::global::gametype; command_result cmd_3dveins(color_ostream &out, std::vector & parameters); @@ -1573,6 +1574,12 @@ command_result cmd_3dveins(color_ostream &con, std::vector & parame return CR_FAILURE; } + if (*gametype != game_type::DWARF_MAIN && *gametype != game_type::DWARF_RECLAIM) + { + con.printerr("Must be used in fortress mode!\n"); + return CR_FAILURE; + } + VeinGenerator generator(con); con.print("Collecting statistics...\n"); From d52a07ef76d3620a7f1eca680bba1cf69f465bd8 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 14 May 2014 18:56:30 -0400 Subject: [PATCH 2/4] Dismiss previous command prompt before creating a new one --- plugins/command-prompt.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index d7a8e230c..19460f19b 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -166,6 +167,10 @@ void viewscreen_commandpromptst::feed(std::set *events) DFHACK_PLUGIN("command-prompt"); command_result show_prompt(color_ostream &out, std::vector & parameters) { + if (Gui::getCurFocus() == "dfhack/commandprompt") + { + Screen::dismiss(Gui::getCurViewscreen(true)); + } std::string params; for(size_t i=0;i Date: Thu, 15 May 2014 15:51:03 -0400 Subject: [PATCH 3/4] Fix handling of newline characters in command-prompt output --- plugins/command-prompt.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index 19460f19b..a5903f2b3 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -56,9 +56,14 @@ public: df::global::gps->display_frames=show_fps; } - void add_response(color_value v,std::string s) + void add_response(color_value v, std::string s) { - responses.push_back(std::make_pair(v,s)); + std::stringstream ss(s); + std::string part; + while (std::getline(ss, part)) + { + responses.push_back(std::make_pair(v, part)); + } } protected: std::list > responses; From 9b1d393c1ca925ac6514d664e9b03a8c9bf676f0 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 15 May 2014 17:30:42 -0400 Subject: [PATCH 4/4] Append newline to each section of output --- plugins/command-prompt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index a5903f2b3..5e84db831 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -62,7 +62,7 @@ public: std::string part; while (std::getline(ss, part)) { - responses.push_back(std::make_pair(v, part)); + responses.push_back(std::make_pair(v, part + '\n')); } } protected: