diff options
| author | Petr Mrázek | 2011-08-09 01:50:22 +0200 |
|---|---|---|
| committer | Petr Mrázek | 2011-08-09 01:50:22 +0200 |
| commit | cc19180ac00c767abe164ad275fab6ab4aeb0888 (patch) | |
| tree | 9e95f92b3f4e5a5cb23409eb9a3acfd1d958acd2 /plugins/plants.cpp | |
| parent | 8fd437dbc1caebf7a8f8b8668e2fe6a2b907f498 (diff) | |
| download | dfhack-cc19180ac00c767abe164ad275fab6ab4aeb0888.tar.gz dfhack-cc19180ac00c767abe164ad275fab6ab4aeb0888.tar.bz2 dfhack-cc19180ac00c767abe164ad275fab6ab4aeb0888.tar.xz | |
Add 'help' options to a bunch of commands.
Diffstat (limited to 'plugins/plants.cpp')
| -rw-r--r-- | plugins/plants.cpp | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/plugins/plants.cpp b/plugins/plants.cpp index 20e1700d..7afa0d89 100644 --- a/plugins/plants.cpp +++ b/plugins/plants.cpp @@ -48,7 +48,7 @@ enum do_what do_extirpate }; -static bool getoptions( vector <string> & parameters, bool & shrubs, bool & trees) +static bool getoptions( vector <string> & parameters, bool & shrubs, bool & trees, bool & help) { for(int i = 0;i < parameters.size();i++) { @@ -65,6 +65,10 @@ static bool getoptions( vector <string> & parameters, bool & shrubs, bool & tree trees = true; shrubs = true; } + else if(parameters[i] == "help" || parameters[i] == "?") + { + help = true; + } else { return false; @@ -79,8 +83,21 @@ static bool getoptions( vector <string> & parameters, bool & shrubs, bool & tree * And he cursed the plants and trees for their bloodless wood, turning them into ash and smoldering ruin. * Armok was pleased and great temples were built by the dwarves, for they shared his hatred for trees and plants. */ -static command_result immolations (Core * c, do_what what, bool shrubs, bool trees) +static command_result immolations (Core * c, do_what what, bool shrubs, bool trees, bool help) { + static const char * what1 = "destroys"; + static const char * what2 = "burns"; + if(help) + { + c->con.print("Without any options, this command %s a plant under the cursor.\n" + "Options:\n" + "shrubs - affect all shrubs\n" + "trees - affect all trees\n" + "all - affect all plants\n", + what == do_immolate? what2 : what1 + ); + return CR_OK; + } c->Suspend(); DFHack::Maps *maps = c->getMaps(); if (!maps->Start()) @@ -158,10 +175,10 @@ static command_result immolations (Core * c, do_what what, bool shrubs, bool tre DFhackCExport command_result df_immolate (Core * c, vector <string> & parameters) { - bool shrubs = false, trees = false; - if(getoptions(parameters,shrubs,trees)) + bool shrubs = false, trees = false, help = false; + if(getoptions(parameters,shrubs,trees,help)) { - return immolations(c,do_immolate,shrubs,trees); + return immolations(c,do_immolate,shrubs,trees, help); } else { @@ -172,10 +189,10 @@ DFhackCExport command_result df_immolate (Core * c, vector <string> & parameters DFhackCExport command_result df_extirpate (Core * c, vector <string> & parameters) { - bool shrubs = false, trees = false; - if(getoptions(parameters,shrubs,trees)) + bool shrubs = false, trees = false, help = false; + if(getoptions(parameters,shrubs,trees, help)) { - return immolations(c,do_extirpate,shrubs,trees); + return immolations(c,do_extirpate,shrubs,trees, help); } else { @@ -186,7 +203,14 @@ DFhackCExport command_result df_extirpate (Core * c, vector <string> & parameter DFhackCExport command_result df_grow (Core * c, vector <string> & parameters) { - //uint32_t x_max = 0, y_max = 0, z_max = 0; + for(int i = 0; i < parameters.size();i++) + { + if(parameters[i] == "help" || parameters[i] == "?") + { + c->con.print("This command turns all living saplings into full-grown trees.\n"); + return CR_OK; + } + } c->Suspend(); DFHack::Maps *maps = c->getMaps(); Console & con = c->con; |
