Merge branches 'search-mouse-crash', 'cmdprompt' and '3dveins-check-mode' into dev-plugins

develop
lethosor 2014-05-16 21:23:34 -04:00
commit f852802270
2 changed files with 19 additions and 2 deletions

@ -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 <std::string> & parameters);
@ -1573,6 +1574,12 @@ command_result cmd_3dveins(color_ostream &con, std::vector<std::string> & 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");

@ -7,6 +7,7 @@
#include <ColorText.h>
#include <modules/Screen.h>
#include <modules/Gui.h>
#include <set>
#include <list>
@ -55,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 + '\n'));
}
}
protected:
std::list<std::pair<color_value,std::string> > responses;
@ -166,6 +172,10 @@ void viewscreen_commandpromptst::feed(std::set<df::interface_key> *events)
DFHACK_PLUGIN("command-prompt");
command_result show_prompt(color_ostream &out, std::vector <std::string> & parameters)
{
if (Gui::getCurFocus() == "dfhack/commandprompt")
{
Screen::dismiss(Gui::getCurViewscreen(true));
}
std::string params;
for(size_t i=0;i<parameters.size();i++)
params+=parameters[i]+" ";