Maraiah/source/marathon/map/note.rs

31 lines
618 B
Rust
Raw Normal View History

2019-04-01 00:39:47 -07:00
//! `Note` type.
use crate::{durandal::err::*, marathon::text::*};
2019-04-01 01:50:05 -07:00
use super::pnts;
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))]
#[derive(Debug, Eq, PartialEq)]
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