fix: substr → resize en 4 llocs
This commit is contained in:
@@ -876,7 +876,7 @@ void MapEditor::updateStatusBarInfo() { // NOLINT(readability-function-cognitiv
|
|||||||
const auto& e = room_data_.enemies[selected_enemy_];
|
const auto& e = room_data_.enemies[selected_enemy_];
|
||||||
std::string anim = e.animation_path;
|
std::string anim = e.animation_path;
|
||||||
auto dot = anim.rfind('.');
|
auto dot = anim.rfind('.');
|
||||||
if (dot != std::string::npos) { anim = anim.substr(0, dot); }
|
if (dot != std::string::npos) { anim.resize(dot); }
|
||||||
|
|
||||||
line2 = "enemy " + std::to_string(selected_enemy_) + ": " + anim + " " + e.color;
|
line2 = "enemy " + std::to_string(selected_enemy_) + ": " + anim + " " + e.color;
|
||||||
line3 = "vx:" + std::to_string(static_cast<int>(e.vx)) +
|
line3 = "vx:" + std::to_string(static_cast<int>(e.vx)) +
|
||||||
|
|||||||
@@ -1068,7 +1068,7 @@ void CommandRegistry::registerHandlers() { // NOLINT(readability-function-cogni
|
|||||||
if (path.find("enemies") == std::string::npos) { continue; }
|
if (path.find("enemies") == std::string::npos) { continue; }
|
||||||
std::string name = getFileName(path);
|
std::string name = getFileName(path);
|
||||||
auto dot = name.rfind('.');
|
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));
|
result.push_back(toUpper(name));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -1082,7 +1082,7 @@ void CommandRegistry::registerHandlers() { // NOLINT(readability-function-cogni
|
|||||||
if (path.find("tilesets") == std::string::npos) { continue; }
|
if (path.find("tilesets") == std::string::npos) { continue; }
|
||||||
std::string name = getFileName(path);
|
std::string name = getFileName(path);
|
||||||
auto dot = name.rfind('.');
|
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));
|
result.push_back(toUpper(name));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -1331,7 +1331,7 @@ auto CommandRegistry::getCompletions(const std::string& path) const -> std::vect
|
|||||||
if (!active_scope_.empty()) {
|
if (!active_scope_.empty()) {
|
||||||
std::string root = path;
|
std::string root = path;
|
||||||
auto space = root.find(' ');
|
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);
|
const auto* cmd = findCommand(root);
|
||||||
if (cmd != nullptr && !isCommandVisible(*cmd)) { return {}; }
|
if (cmd != nullptr && !isCommandVisible(*cmd)) { return {}; }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user