fix: resta tidy (60 troballes — empty-catch, widening, branch-clone, etc.)
This commit is contained in:
@@ -66,9 +66,11 @@ auto Console::wrapText(const std::string& text) const -> std::vector<std::string
|
||||
std::istringstream word_stream(segment);
|
||||
std::string word;
|
||||
while (word_stream >> word) {
|
||||
const std::string TEST = current_line.empty() ? word : (current_line + ' ' + word);
|
||||
if (text_->length(TEST) <= MAX_PX) {
|
||||
current_line = TEST;
|
||||
std::string test = current_line;
|
||||
if (!test.empty()) { test += ' '; }
|
||||
test += word;
|
||||
if (text_->length(test) <= MAX_PX) {
|
||||
current_line = std::move(test);
|
||||
} else {
|
||||
if (!current_line.empty()) { result.push_back(current_line); }
|
||||
current_line = word;
|
||||
@@ -182,10 +184,10 @@ void Console::update(float delta_time) { // NOLINT(readability-function-cogniti
|
||||
|
||||
// Efecto typewriter: revelar letras una a una (solo cuando ACTIVE)
|
||||
if (status_ == Status::ACTIVE) {
|
||||
const int total_chars = std::accumulate(msg_lines_.begin(), msg_lines_.end(), 0, [](int acc, const auto& line) { return acc + static_cast<int>(line.size()); });
|
||||
if (typewriter_chars_ < total_chars) {
|
||||
const int TOTAL_CHARS = std::accumulate(msg_lines_.begin(), msg_lines_.end(), 0, [](int acc, const auto& line) { return acc + static_cast<int>(line.size()); });
|
||||
if (typewriter_chars_ < TOTAL_CHARS) {
|
||||
typewriter_timer_ += delta_time;
|
||||
while (typewriter_timer_ >= TYPEWRITER_CHAR_DELAY && typewriter_chars_ < total_chars) {
|
||||
while (typewriter_timer_ >= TYPEWRITER_CHAR_DELAY && typewriter_chars_ < TOTAL_CHARS) {
|
||||
typewriter_timer_ -= TYPEWRITER_CHAR_DELAY;
|
||||
++typewriter_chars_;
|
||||
}
|
||||
@@ -345,7 +347,10 @@ void Console::handleEvent(const SDL_Event& event) { // NOLINT(readability-funct
|
||||
const auto OPTS = registry_.getCompletions(BASE_CMD);
|
||||
for (const auto& arg : OPTS) {
|
||||
if (SUB_PREFIX.empty() || std::string_view{arg}.starts_with(SUB_PREFIX)) {
|
||||
tab_matches_.emplace_back(BASE_CMD + " " + arg);
|
||||
std::string match = BASE_CMD;
|
||||
match += ' ';
|
||||
match += arg;
|
||||
tab_matches_.push_back(std::move(match));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user