Maraiah/maraiah/map/note.rs

31 lines
605 B
Rust

//! `Note` type.
use super::pnts;
use crate::{err::*, text::*};
/// Reads a `NOTE` chunk.
pub fn read(b: &[u8]) -> ResultS<(Note, usize)>
{
read_data! {
endian: BIG, buf: b, size: 72, start: 0, data {
let pos = pnts::read_o[2; 4];
let poly = u16[6];
let text = mac_roman_cstr[8; 64] no_try;
}
}
Ok((Note{pos, poly, text}, 72))
}
/// Overhead map annotations.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Note
{
pub pos: pnts::Point,
pub poly: u16,
pub text: String,
}
// EOF