From ef3a6026f551f687ad8d2576b7fde2f4f3c55fd6 Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Thu, 7 Nov 2024 09:22:19 +0100 Subject: [PATCH] minor fixes --- .gitea/workflows/publish.yaml | 2 +- src/level_ladder.rs | 4 ++-- src/main.rs | 23 +++++++---------------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml index 7e35e2a..f0d447e 100644 --- a/.gitea/workflows/publish.yaml +++ b/.gitea/workflows/publish.yaml @@ -23,4 +23,4 @@ jobs: UPLOAD_FILE=$(ls target/debian/*.deb) curl --user jlusiardi:${{ secrets.UPLOAD_TOKEN }} --upload-file ${UPLOAD_FILE} https://gitea.intern.haus-in-hirschaid.de/api/packages/jlusiardi/debian/pool/bionic/main/upload echo ${DEPLOY_PRIVATE_KEY} > /tmp/ssh_key - scp -i /tmp/ssh_key ${UPLOAD_FILE} jlusiardi@april2023.lusiardi.de:/var/www/p17.lusiardi.de/el_diabolo \ No newline at end of file + scp -o StrictHostKeyChecking=no -i /tmp/ssh_key ${UPLOAD_FILE} jlusiardi@april2023.lusiardi.de:/var/www/p17.lusiardi.de/el_diabolo \ No newline at end of file diff --git a/src/level_ladder.rs b/src/level_ladder.rs index c012091..b89eb6f 100644 --- a/src/level_ladder.rs +++ b/src/level_ladder.rs @@ -10,9 +10,9 @@ impl Iterator for LevelLadder { let current = self.curr; self.curr = self.next; - self.next = current + self.next; + self.next += current; - // Since there's no endpoint to a Fibonacci sequence, the `Iterator` + // Since there's no endpoint to a Fibonacci sequence, the `Iterator` // will never return `None`, and `Some` is always returned. Some(current * 30) } diff --git a/src/main.rs b/src/main.rs index c26e377..bc317c2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,6 @@ use crossterm::{ ExecutableCommand, }; use ratatui::prelude::*; -use ratatui::widgets::block::{Position, Title}; use ratatui::widgets::{Block, BorderType, Borders, Wrap}; use ratatui::{ prelude::{CrosstermBackend, Terminal}, @@ -32,12 +31,12 @@ mod constants; mod game; mod level; mod level_generator; +mod level_ladder; mod level_widget; mod monster; mod player; mod position; mod room; -mod level_ladder; // fn main() -> Result<()> { @@ -101,10 +100,8 @@ fn main() -> Result<()> { height: map_area.height / 2 + 1, }; let block = Block::default() - .title( - Title::from(format!(" {} ", game.get_player().get_name())) - .alignment(Alignment::Center) - .position(Position::Top), + .title_top( + Line::from(format!(" {} ", game.get_player().get_name())).centered() ) .borders(Borders::TOP) .border_style(Style::default().fg(Color::White)) @@ -134,10 +131,8 @@ fn main() -> Result<()> { }; // Display the latest messages from the game to the user let block = Block::default() - .title( - Title::from(" messages ") - .alignment(Alignment::Center) - .position(Position::Top), + .title_top( + Line::from(" messages ").centered() ) .borders(Borders::TOP) .border_style(Style::default().fg(Color::White)) @@ -219,12 +214,8 @@ fn main() -> Result<()> { area.width = 40; area.height = 20; let block = Block::default() - .title( - Title::from(" Game ended ") - .alignment(Alignment::Center) - .position(Position::Top), - ) - .title(Title::from("Press `q` to quit!").position(Position::Bottom)) + .title_top(Line::from(" Game ended ").centered()) + .title_bottom(Line::from("Press `q` to quit!")) .borders(Borders::ALL) .border_style(Style::default().fg(Color::White)) .border_type(BorderType::Rounded)