Reduce nesting a bit

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion 2025-08-02 22:59:34 +02:00
parent ef64029795
commit 4fbbb6f0f2
No known key found for this signature in database
1 changed files with 147 additions and 144 deletions

View File

@ -457,7 +457,19 @@ pub fn main() !void {
if (update) {
// If the user entered a wrong password 10 times in a row, play a cascade animation, else update normally
if (auth_fails < config.auth_fails) {
if (auth_fails >= config.auth_fails) {
std.Thread.sleep(std.time.ns_per_ms * 10);
update = buffer.cascade();
if (!update) {
std.Thread.sleep(std.time.ns_per_s * 7);
auth_fails = 0;
}
_ = termbox.tb_present();
continue;
}
_ = termbox.tb_clear();
var length: usize = 0;
@ -600,15 +612,6 @@ pub fn main() !void {
session.label.draw();
login.label.draw();
password.draw();
} else {
std.Thread.sleep(std.time.ns_per_ms * 10);
update = buffer.cascade();
if (!update) {
std.Thread.sleep(std.time.ns_per_s * 7);
auth_fails = 0;
}
}
_ = termbox.tb_present();
}