linters
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
// Toggle genérico para comandos booleanos ON/OFF (reemplaza macro BOOL_TOGGLE_CMD)
|
||||
static auto boolToggle(
|
||||
const std::string& label,
|
||||
bool& option,
|
||||
const bool& option,
|
||||
const std::function<void()>& toggle_fn,
|
||||
const std::vector<std::string>& args) -> std::string {
|
||||
if (args.empty()) {
|
||||
@@ -259,7 +259,9 @@ static auto cmdZoom(const std::vector<std::string>& args) -> std::string {
|
||||
if (N == Options::window.zoom) { return "Zoom already " + std::to_string(N); }
|
||||
Screen::get()->setWindowZoom(N);
|
||||
return "Zoom " + std::to_string(Options::window.zoom);
|
||||
} catch (...) {}
|
||||
} catch (...) {
|
||||
// @INTENTIONAL: argumento no numérico → mostrar usage
|
||||
}
|
||||
return "usage: zoom [up|down|<1-" + std::to_string(Screen::getMaxZoom()) + ">]";
|
||||
}
|
||||
|
||||
@@ -704,7 +706,7 @@ static auto cmdEdit(const std::vector<std::string>& args) -> std::string { // N
|
||||
if ((args[0] == "SHOW" || args[0] == "HIDE") && args.size() >= 2) {
|
||||
if ((MapEditor::get() == nullptr) || !MapEditor::get()->isActive()) { return "Editor not active"; }
|
||||
bool show = (args[0] == "SHOW");
|
||||
if (args[1] == "INFO") { return MapEditor::get()->showInfo(show); }
|
||||
if (args[1] == "INFO") { return MapEditor::showInfo(show); }
|
||||
if (args[1] == "GRID") { return MapEditor::get()->showGrid(show); }
|
||||
}
|
||||
// EDIT DRAW / EDIT COLLISION
|
||||
@@ -878,6 +880,7 @@ static auto cmdCheat(const std::vector<std::string>& args) -> std::string { //
|
||||
auto& cheat = Options::cheats.infinite_lives;
|
||||
using State = Options::Cheat::State;
|
||||
const std::vector<std::string> REST(args.begin() + 2, args.end());
|
||||
// cppcheck-suppress knownConditionTrueFalse -- cppcheck no infiere que REST puede estar vacío cuando args.size() == 2.
|
||||
if (REST.empty()) {
|
||||
cheat = (cheat == State::ENABLED) ? State::DISABLED : State::ENABLED;
|
||||
} else if (REST[0] == "ON") {
|
||||
@@ -1113,7 +1116,7 @@ void CommandRegistry::registerHandlers() { // NOLINT(readability-function-cogni
|
||||
if (path.find("tilesets") == std::string::npos) { continue; }
|
||||
std::string name = getFileName(path);
|
||||
auto dot = name.rfind('.');
|
||||
if (dot != std::string::npos) { name = name.substr(0, dot); }
|
||||
if (dot != std::string::npos) { name.resize(dot); }
|
||||
result.push_back(toUpper(name));
|
||||
}
|
||||
return result;
|
||||
@@ -1362,7 +1365,7 @@ auto CommandRegistry::getCompletions(const std::string& path) const -> std::vect
|
||||
if (!active_scope_.empty()) {
|
||||
std::string root = path;
|
||||
auto space = root.find(' ');
|
||||
if (space != std::string::npos) { root = root.substr(0, space); }
|
||||
if (space != std::string::npos) { root.resize(space); }
|
||||
const auto* cmd = findCommand(root);
|
||||
if (cmd != nullptr && !isCommandVisible(*cmd)) { return {}; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user