mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 17:57:01 +02:00
refactor: migrate to C++11
This commit is contained in:
7 files changed
+35
-28
No files matched your search
@@ -74,13 +74,13 @@ void TuiExploitPanel::draw(int sy, int sx, int selected) {
|
||||
mvprintw(sy + 8, content_x, "%.*s", kExploitContentWidth, status_text.empty() ? stage_to_string(STAGE_RESET) : status_text.c_str());
|
||||
|
||||
const int bar_width = 50;
|
||||
const int filled = (std::clamp(progress, 0, 100) * bar_width) / 100;
|
||||
const int filled = (std::min(std::max(progress, 0), 100) * bar_width) / 100;
|
||||
std::string bar(static_cast<size_t>(bar_width), '-');
|
||||
for (int i = 0; i < filled; ++i) {
|
||||
bar[static_cast<size_t>(i)] = '#';
|
||||
}
|
||||
|
||||
mvprintw(sy + 10, sx + 2, "[%s] %3d%%", bar.c_str(), std::clamp(progress, 0, 100));
|
||||
mvprintw(sy + 10, sx + 2, "[%s] %3d%%", bar.c_str(), std::min(std::max(progress, 0), 100));
|
||||
}
|
||||
|
||||
void TuiExploitPanel::handle_enter(int selected, int sy, int sx) {
|
||||
@@ -105,7 +105,7 @@ bool TuiExploitPanel::is_button_enabled(int btn_idx) const {
|
||||
void TuiExploitPanel::set_status(const std::string& status, int progress) {
|
||||
std::lock_guard<std::mutex> lock(m_status_mutex);
|
||||
m_status_text = status;
|
||||
m_progress = std::clamp(progress, 0, 100);
|
||||
m_progress = std::min(std::max(progress, 0), 100);
|
||||
}
|
||||
|
||||
void TuiExploitPanel::exploit()
|
||||
|
||||
Reference in new issue
Block a user