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/liquids.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/liquids.cpp')
| -rw-r--r-- | plugins/liquids.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/liquids.cpp b/plugins/liquids.cpp index 27035bff..56e1b69a 100644 --- a/plugins/liquids.cpp +++ b/plugins/liquids.cpp @@ -140,6 +140,8 @@ public: }; }; +CommandHistory liquids_hist; + DFhackCExport command_result df_liquids (Core * c, vector <string> & parameters); DFhackCExport const char * plugin_name ( void ) @@ -149,6 +151,7 @@ DFhackCExport const char * plugin_name ( void ) DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands) { + liquids_hist.load("liquids.history"); commands.clear(); commands.push_back(PluginCommand("liquids", "Place magma, water or obsidian.", df_liquids, true)); return CR_OK; @@ -156,6 +159,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> DFhackCExport command_result plugin_shutdown ( Core * c ) { + liquids_hist.save("liquids.history"); return CR_OK; } @@ -192,7 +196,7 @@ DFhackCExport command_result df_liquids (Core * c, vector <string> & parameters) string command = ""; std::stringstream str; str <<"[" << mode << ":" << brushname << ":" << amount << ":" << flowmode << ":" << setmode << "]#"; - if(c->con.lineedit(str.str(),command) == -1) + if(c->con.lineedit(str.str(),command,liquids_hist) == -1) return CR_FAILURE; if(command=="help" || command == "?") { @@ -260,20 +264,24 @@ DFhackCExport command_result df_liquids (Core * c, vector <string> & parameters) else if(command == "range" || command == "r") { std::stringstream str; + CommandHistory range_hist; str << " :set range width<" << width << "># "; - c->con.lineedit(str.str(),command); + c->con.lineedit(str.str(),command,range_hist); + range_hist.add(command); width = command == "" ? width : atoi (command.c_str()); if(width < 1) width = 1; str.clear(); str << " :set range height<" << height << "># "; - c->con.lineedit(str.str(),command); + c->con.lineedit(str.str(),command,range_hist); + range_hist.add(command); height = command == "" ? height : atoi (command.c_str()); if(height < 1) height = 1; str.clear(); str << " :set range z-levels<" << z_levels << "># "; - c->con.lineedit(str.str(),command); + c->con.lineedit(str.str(),command,range_hist); + range_hist.add(command); z_levels = command == "" ? z_levels : atoi (command.c_str()); if(z_levels < 1) z_levels = 1; delete brush; |
