diff options
| author | Petr Mrázek | 2011-08-13 14:42:09 +0200 |
|---|---|---|
| committer | Petr Mrázek | 2011-08-13 14:42:09 +0200 |
| commit | 81e6bce92ce0efd8dda1036a84a24655f8bbf82d (patch) | |
| tree | 7ea53d7f3c7b013c5042ead5b350ef64ed2c4982 /plugins/tiletypes.cpp | |
| parent | 1cbcb99dd53a9236e1e008ed8a4447296973e399 (diff) | |
| download | dfhack-81e6bce92ce0efd8dda1036a84a24655f8bbf82d.tar.gz dfhack-81e6bce92ce0efd8dda1036a84a24655f8bbf82d.tar.bz2 dfhack-81e6bce92ce0efd8dda1036a84a24655f8bbf82d.tar.xz | |
Command history separated from Console.
Diffstat (limited to 'plugins/tiletypes.cpp')
| -rw-r--r-- | plugins/tiletypes.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/tiletypes.cpp b/plugins/tiletypes.cpp index b1e4e024..5fb5f7e7 100644 --- a/plugins/tiletypes.cpp +++ b/plugins/tiletypes.cpp @@ -411,6 +411,8 @@ public: }; }; +CommandHistory tiletypes_hist; + DFhackCExport command_result df_tiletypes (Core * c, vector <string> & parameters); DFhackCExport const char * plugin_name ( void ) @@ -420,6 +422,7 @@ DFhackCExport const char * plugin_name ( void ) DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands) { + tiletypes_hist.load("tiletypes.history"); commands.clear(); commands.push_back(PluginCommand("tiletypes", "Paint map tiles freely, similar to liquids.", df_tiletypes, true)); return CR_OK; @@ -427,6 +430,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> DFhackCExport command_result plugin_shutdown ( Core * c ) { + tiletypes_hist.save("tiletypes.history"); return CR_OK; } @@ -455,7 +459,8 @@ DFhackCExport command_result df_tiletypes (Core * c, vector <string> & parameter std::string option = ""; std::string value = ""; - c->con.lineedit("tiletypes> ",input); + c->con.lineedit("tiletypes> ",input,tiletypes_hist); + tiletypes_hist.add(input); std::istringstream ss(input); ss >> command >> option >> value; tolower(command); @@ -486,20 +491,21 @@ DFhackCExport command_result df_tiletypes (Core * c, vector <string> & parameter else if (command == "range" || command == "r") { std::stringstream ss; + CommandHistory hist; ss << "Set range width <" << width << "> "; - c->con.lineedit(ss.str(),command); + c->con.lineedit(ss.str(),command,hist); width = command == "" ? width : toint(command); if (width < 1) width = 1; ss.str(""); ss << "Set range height <" << height << "> "; - c->con.lineedit(ss.str(),command); + c->con.lineedit(ss.str(),command,hist); height = command == "" ? height : toint(command); if (height < 1) height = 1; ss.str(""); ss << "Set range z-levels <" << z_levels << "> "; - c->con.lineedit(ss.str(),command); + c->con.lineedit(ss.str(),command,hist); z_levels = command == "" ? z_levels : toint(command); if (z_levels < 1) z_levels = 1; |
