Maraiah/maraiah/map/note.rs

31 lines
605 B
Rust
Raw Normal View History

2019-04-01 00:39:47 -07:00
//! `Note` type.
2019-04-01 01:50:05 -07:00
use super::pnts;
2019-06-13 18:09:07 -07:00
use crate::{err::*, text::*};
2019-04-01 00:39:47 -07:00
/// Reads a `NOTE` chunk.
pub fn read(b: &[u8]) -> ResultS<(Note, usize)>
{
read_data! {
endian: BIG, buf: b, size: 72, start: 0, data {
2019-04-01 01:50:05 -07:00
let pos = pnts::read_o[2; 4];
2019-04-01 00:39:47 -07:00
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))]
2019-06-21 18:34:10 -07:00
#[derive(Clone, Debug, Eq, PartialEq)]
2019-04-01 00:39:47 -07:00
pub struct Note
{
2019-04-01 01:50:05 -07:00
pub pos: pnts::Point,
2019-04-01 00:39:47 -07:00
pub poly: u16,
pub text: String,
}
// EOF