Fixes uninitialized warning

develop
Josh Cooper 2022-10-14 18:23:48 -07:00
parent 9b1541add5
commit 851ff10959
1 changed files with 5 additions and 6 deletions

@ -258,7 +258,7 @@ void enable_auto_unpause(color_ostream &out, bool state) {
command_result spectate (color_ostream &out, std::vector <std::string> & parameters) { command_result spectate (color_ostream &out, std::vector <std::string> & parameters) {
if (!parameters.empty()) { if (!parameters.empty()) {
if (parameters.size() >= 2 && parameters.size() <= 3) { if (parameters.size() >= 2 && parameters.size() <= 3) {
bool state; bool state =false;
bool set = false; bool set = false;
if (parameters[0] == "enable") { if (parameters[0] == "enable") {
state = true; state = true;
@ -269,14 +269,13 @@ command_result spectate (color_ostream &out, std::vector <std::string> & paramet
} else { } else {
return DFHack::CR_WRONG_USAGE; return DFHack::CR_WRONG_USAGE;
} }
auto &arg = parameters[1]; if(parameters[1] == "auto-unpause"){
if(arg == "auto-unpause"){
enable_auto_unpause(out, state); enable_auto_unpause(out, state);
} else if (arg == "auto-disengage") { } else if (parameters[1] == "auto-disengage") {
disengage_enabled = state; disengage_enabled = state;
} else if (arg == "focus-jobs") { } else if (parameters[1] == "focus-jobs") {
focus_jobs_enabled = state; focus_jobs_enabled = state;
} else if (arg == "tick-threshold" && set && parameters.size() == 3) { } else if (parameters[1] == "tick-threshold" && set && parameters.size() == 3) {
try { try {
tick_threshold = std::stol(parameters[2]); tick_threshold = std::stol(parameters[2]);
} catch (const std::exception &e) { } catch (const std::exception &e) {