final refactors
This commit is contained in:
+2
-18
@@ -17,7 +17,7 @@ mod speech;
|
||||
mod ui;
|
||||
mod input;
|
||||
|
||||
use kiln_core::game::{GameState, ScrollLine};
|
||||
use kiln_core::game::GameState;
|
||||
use kiln_core::log::LogLine;
|
||||
use kiln_core::map_file;
|
||||
use ratatui::Frame;
|
||||
@@ -39,21 +39,6 @@ use crate::scroll_overlay::ScrollOverlayWidget;
|
||||
use crate::speech::SpeechBubblesWidget;
|
||||
use crate::ui::Ui;
|
||||
|
||||
/// Returns the choice string for the given key character, or `None` if it doesn't
|
||||
/// match any choice in the scroll. Choices are assigned letters a, b, c… in order.
|
||||
fn resolve_choice(lines: &[ScrollLine], c: char) -> Option<String> {
|
||||
let mut letter = b'a';
|
||||
for line in lines {
|
||||
if let ScrollLine::Choice { choice, .. } = line {
|
||||
if c == letter as char {
|
||||
return Some(choice.clone());
|
||||
}
|
||||
letter += 1;
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Entry point: parse the map path, load the board, then run the play loop with
|
||||
/// the terminal in raw/alternate-screen mode (restored on every exit path).
|
||||
fn main() -> ExitCode {
|
||||
@@ -173,8 +158,7 @@ fn run(
|
||||
/// A scroll overlay is drawn on top of everything when active.
|
||||
fn draw(frame: &mut Frame, game: &GameState, ui: &mut Ui) {
|
||||
// Borrow the board for the duration of the frame (no script runs during draw).
|
||||
let board = game.board();
|
||||
let board = &*board;
|
||||
let board = &game.board();
|
||||
|
||||
if ui.log.open {
|
||||
// Split the screen: board on top, log panel of `height` at the bottom.
|
||||
|
||||
Reference in New Issue
Block a user