master
rascul 3 years ago
parent 4f0b3e2d65
commit 73b2f1421f

@ -104,7 +104,7 @@ fn main() -> Result<(), Box<dyn Error>> {
} }
for (vnum, room) in tintin_rooms { for (vnum, room) in tintin_rooms {
println!("R {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}}", vnum, room.flags, room.color, room.name, room.symbol, room.desc, room.area, room.note, room.terrain, room.data, room.weight, room.id); println!("{}", room);
for exit in room.exits { for exit in room.exits {
println!( println!(

@ -1,3 +1,5 @@
use std::fmt;
use crate::tintin; use crate::tintin;
#[derive(Debug)] #[derive(Debug)]
@ -41,3 +43,24 @@ pub struct Room {
/// exits /// exits
pub exits: Vec<tintin::Exit>, pub exits: Vec<tintin::Exit>,
} }
impl fmt::Display for Room {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"R {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}} {{{}}}",
&self.vnum,
&self.flags,
&self.color,
&self.name,
&self.symbol,
&self.desc,
&self.area,
&self.note,
&self.terrain,
&self.data,
&self.weight,
&self.id
)
}
}

Loading…
Cancel
Save