Fix "fastdwarf" command to print syntax where appropriate, silence warning

develop
Quietust 2012-10-17 07:57:14 -05:00
parent 0046b093f7
commit 5f4f540bfa
1 changed files with 5 additions and 14 deletions

@ -42,7 +42,6 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
return CR_OK; return CR_OK;
} }
df::map_block *old_block, *new_block;
for (size_t i = 0; i < world->units.active.size(); i++) for (size_t i = 0; i < world->units.active.size(); i++)
{ {
df::unit *unit = world->units.active[i]; df::unit *unit = world->units.active[i];
@ -108,12 +107,10 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
static command_result fastdwarf (color_ostream &out, vector <string> & parameters) static command_result fastdwarf (color_ostream &out, vector <string> & parameters)
{ {
if (parameters.size() > 2) { if (parameters.size() > 2)
out.print("Incorrect usage.\n"); return CR_WRONG_USAGE;
return CR_FAILURE;
}
if (parameters.size() <= 2) if ((parameters.size() == 1) || (parameters.size() == 2))
{ {
if (parameters.size() == 2) if (parameters.size() == 2)
{ {
@ -122,10 +119,7 @@ static command_result fastdwarf (color_ostream &out, vector <string> & parameter
else if (parameters[1] == "1") else if (parameters[1] == "1")
enable_teledwarf = true; enable_teledwarf = true;
else else
{ return CR_WRONG_USAGE;
out.print("Incorrect usage.\n");
return CR_FAILURE;
}
} }
else else
enable_teledwarf = false; enable_teledwarf = false;
@ -155,10 +149,7 @@ static command_result fastdwarf (color_ostream &out, vector <string> & parameter
} }
} }
else else
{ return CR_WRONG_USAGE;
out.print("Incorrect usage.\n");
return CR_FAILURE;
}
} }
out.print("Current state: fast = %d, teleport = %d.\n", out.print("Current state: fast = %d, teleport = %d.\n",