Support the built-in command: look
This commit is contained in:
parent
82001b99b7
commit
b82b87345e
|
@ -1,5 +1,5 @@
|
||||||
use crate::io::display;
|
use crate::io::display;
|
||||||
use crate::models::commands::{BuiltinCommand, AiCommand, CommandExecution};
|
use crate::models::commands::{AiCommand, BuiltinCommand, CommandExecution};
|
||||||
use crate::state::GameState;
|
use crate::state::GameState;
|
||||||
use crate::{commands::CommandExecutor, db::Database};
|
use crate::{commands::CommandExecutor, db::Database};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
@ -48,7 +48,12 @@ impl GameLoop {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO this will probably eventually be moved to its own file.
|
||||||
async fn handle_builtin(&mut self, builtin: BuiltinCommand) -> Result<()> {
|
async fn handle_builtin(&mut self, builtin: BuiltinCommand) -> Result<()> {
|
||||||
|
match builtin {
|
||||||
|
BuiltinCommand::Look => display!("{}", self.state.current_scene),
|
||||||
|
};
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@ pub(crate) fn display_text<S : AsRef<str>>(text: S) {
|
||||||
|
|
||||||
macro_rules! display {
|
macro_rules! display {
|
||||||
($text:expr) => {
|
($text:expr) => {
|
||||||
crate::io::display_text($text);
|
crate::io::display_text($text)
|
||||||
};
|
};
|
||||||
|
|
||||||
($fmt:expr, $text:expr) => {
|
($fmt:expr, $text:expr) => {
|
||||||
crate::io::display_text(format!($fmt, $text));
|
crate::io::display_text(format!($fmt, $text))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue