Make catsplosion work on any specified creature(s)

Also add a "list" option
develop
lethosor 2014-05-16 22:00:26 -04:00
parent a7922937f5
commit 645c2a7f86
1 changed files with 23 additions and 3 deletions

@ -50,9 +50,26 @@ DFhackCExport command_result plugin_shutdown ( color_ostream &out )
command_result catsplosion (color_ostream &out, std::vector <std::string> & parameters) command_result catsplosion (color_ostream &out, std::vector <std::string> & parameters)
{ {
bool list_only = false;
list<string> s_creatures; list<string> s_creatures;
// only cats for now. if (parameters.size())
s_creatures.push_back("CAT"); {
for (size_t i = 0; i < parameters.size(); i++)
{
if (parameters[i] == "list")
{
list_only = true;
}
else
{
s_creatures.push_back(parameters[i]);
}
}
}
else
{
s_creatures.push_back("CAT");
}
// make the creature list unique ... with cats. they are always unique // make the creature list unique ... with cats. they are always unique
s_creatures.unique(); s_creatures.unique();
// SUSPEND THE CORE! ::Evil laugh:: // SUSPEND THE CORE! ::Evil laugh::
@ -103,7 +120,10 @@ command_result catsplosion (color_ostream &out, std::vector <std::string> & para
} }
} }
if (list_only)
{
return CR_OK;
}
// process // process
for (list<string>::iterator it = s_creatures.begin(); it != s_creatures.end(); ++it) for (list<string>::iterator it = s_creatures.begin(); it != s_creatures.end(); ++it)
{ {