maraiah: fix tests and move code to root

master
an 2019-06-22 00:55:08 -04:00
родитель bfb91792ec
Коммит daebfd2da6
124 изменённых файлов: 2470 добавлений и 264 удалений

Просмотреть файл

@ -14,10 +14,10 @@ publish = false
serde_obj = ["serde"]
[workspace]
members = ["source/leela", "source/tycho"]
members = ["leela", "tycho"]
[dependencies]
bitflags = "1.0"
bitflags = "1.1"
failure = {version = "0.1", features = ["std"]}
serde = {version = "1.0", features = ["derive"], optional = true}
memchr = "2.0"
@ -31,4 +31,4 @@ lto = true
[lib]
name = "maraiah"
path = "source/lib.rs"
path = "maraiah/lib.rs"

14
leela/Cargo.toml Normal file
Просмотреть файл

@ -0,0 +1,14 @@
[package]
name = "maraiah-leela"
version = "0.0.0"
edition = "2018"
[dependencies]
clap = "2"
maraiah = {path = "..", features = ["serde_obj"]}
serde = "1.0"
serde_yaml = "0.8"
[[bin]]
name = "leela"
path = "main.rs"

Просмотреть файл

@ -1,13 +1,13 @@
#![allow(clippy::unit_arg)]
use maraiah::{err::*, file::*, image::*, sound::*,
machdr, map, shp, snd};
use maraiah::{err::*, file::*, image::*, machdr, map, shp, snd, sound::*};
use std::{collections::HashSet, fs, io, slice::from_ref};
fn open(path: &str) -> ResultS<memmap::Mmap>
/*
fn open(path: &str) -> ResultS<io::BufReader>
{
let fp = fs::File::open(path)?;
Ok(unsafe {memmap::Mmap::map(&fp)?})
Ok(io::BufReader::new(fp))
}
fn file_read<T, F>(path: &str, f: F) -> ResultS<T>
@ -22,14 +22,15 @@ fn file_read<T, F>(path: &str, f: F) -> ResultS<T>
fn exists(path: String) -> Result<(), String>
{
match std::fs::metadata(path) {
Ok(_) => Ok(()),
Ok(_) => Ok(()),
Err(e) => Err(e.to_string()),
}
}
fn each_value<F>(opt: &clap::ArgMatches<'_>,
name: &str,
mut f: F) -> ResultS<()>
mut f: F)
-> ResultS<()>
where F: FnMut(&str) -> ResultS<()>
{
if let Some(values) = opt.values_of(name) {
@ -91,43 +92,60 @@ fn sub_info_c(opt: &clap::ArgMatches<'_>) -> ResultS<()>
Ok(())
}
*/
fn main() -> ResultS<()>
{
use std::io::prelude::*;
let inp = include_bytes!("../tests/data/map/Test.in");
let mut rd = std::io::BufReader::new(&inp[..]);
let mp = map::head::read(&mut rd).unwrap();
let en = map::entr::read_all(&mp).unwrap();
let ed = map::data::read_all(mp.head(), &en).unwrap();
write!(&mut std::fs::File::create("dicks.txt").unwrap(), "{:#?}", ed);
/*
use clap::clap_app;
let sub_data =
clap_app!(@subcommand data =>
(about: "Dumps data into a discrete folder/YAML format"));
let sub_data = clap_app! {
@subcommand data =>
(about: "Dumps data into a discrete folder/YAML format")
};
let sub_dump =
clap_app!(@subcommand dump =>
let sub_dump = clap_app! {
@subcommand dump =>
(about: "Dumps particular parts of data")
(@arg chunks: -c --chunks [name]... "Dumps named chunks from an entry")
(@group files =>
(@attributes +required +multiple)
(@arg map: -m --map [file]... {exists} "Loads Map files")
(@arg shp: -s --shp [file]... {exists} "Loads Shapes files")
(@arg snd: -n --snd [file]... {exists} "Loads Sounds files")));
(@attributes +required +multiple)
(@arg map: -m --map [file]... {exists} "Loads Map files")
(@arg shp: -s --shp [file]... {exists} "Loads Shapes files")
(@arg snd: -n --snd [file]... {exists} "Loads Sounds files"))
};
let sub_info =
clap_app!(@subcommand info =>
let sub_info = clap_app! {
@subcommand info =>
(about: "Outputs debug info")
(@group files =>
(@attributes +required +multiple)
(@arg map: -m --map [file]... {exists} "Loads Map files")
(@arg shp: -s --shp [file]... {exists} "Loads Shapes files")
(@arg snd: -n --snd [file]... {exists} "Loads Sounds files")));
(@attributes +required +multiple)
(@arg map: -m --map [file]... {exists} "Loads Map files")
(@arg shp: -s --shp [file]... {exists} "Loads Shapes files")
(@arg snd: -n --snd [file]... {exists} "Loads Sounds files"))
};
let opt =
clap_app!((env!("CARGO_PKG_NAME")) =>
(version: env!("CARGO_PKG_VERSION"))
(author: env!("CARGO_PKG_AUTHORS"))
(about: env!("CARGO_PKG_DESCRIPTION"))
let opt = clap_app! {
(env!("CARGO_PKG_NAME")) =>
(version: maraiah::meta::version())
(author: maraiah::meta::authors().replace(':', ", "))
(about: maraiah::meta::description())
(setting: clap::AppSettings::SubcommandRequiredElseHelp)
(subcommand: sub_data)
(subcommand: sub_dump)
(subcommand: sub_info));
(subcommand: sub_info)
};
let opt = opt.get_matches();
@ -137,6 +155,7 @@ fn main() -> ResultS<()>
("info", Some(opt)) => sub_info_c(opt)?,
_ => unreachable!(),
}
*/
Ok(())
}

Просмотреть файл

@ -559,7 +559,7 @@ impl OptU16
}
}
impl fmt::Debug for OptU16
impl fmt::Display for OptU16
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{
@ -570,6 +570,17 @@ impl fmt::Debug for OptU16
}
}
impl fmt::Debug for OptU16
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{
match self.get() {
None => write!(f, "OptU16::none()"),
Some(n) => write!(f, "OptU16::from({})", n),
}
}
}
impl PartialEq<[u8; 4]> for Ident
{
#[inline]

Просмотреть файл

Просмотреть файл

@ -16,7 +16,6 @@
/// use std::convert::TryFrom;
///
/// c_enum! {
/// #[derive(Debug)]
/// enum MyEnum: u16
/// {
/// Zero = 0,
@ -43,7 +42,7 @@ macro_rules! c_enum
}
) => {
$(#[$outer])*
#[derive(Copy, Clone, Eq, Ord, PartialEq, PartialOrd)]
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
#[repr($ti)]
$vi enum $t
{
@ -74,7 +73,6 @@ mod test
use std::convert::TryFrom;
c_enum! {
#[derive(Debug)]
enum TestEnum: u16
{
Zero = 0,

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -588,7 +588,9 @@ macro_rules! define_fixed_types {
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{
fmt::Display::fmt(self, f)
write!(f,
concat!(stringify!($t), "::from_bits({})"),
self.to_bits())
}
}
)*};

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -75,7 +75,6 @@ bitflags! {
c_enum! {
/// A named type of damage taken by something.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum DamageType: u16
{
Explosion = 0,

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -134,7 +134,7 @@ pub struct Map
c_enum! {
/// The version of a Map file.
#[derive(Debug)]
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
pub enum Ver: u16
{
Base = 0,

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -101,7 +101,6 @@ bitflags! {
c_enum! {
/// The type of a `Light`.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum LightType: u16
{
Normal = 0,

Просмотреть файл

@ -45,7 +45,6 @@ pub struct LightFunc
c_enum! {
/// The type of function for a `LightFunc`.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum LightFuncType: u16
{
Constant = 0,

Просмотреть файл

@ -53,7 +53,6 @@ pub struct Media
c_enum! {
/// The liquid type of a `Media`.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum MediaType: u16
{
Water = 0,

Просмотреть файл

@ -11,10 +11,10 @@ pub fn read(b: &[u8]) -> ResultS<Info>
let texture_id = u16[0];
let physics_id = u16[2];
let skypict_id = u16[4];
let miss_flags = u16[6] flag MsnFlags;
let envi_flags = u16[8] flag EnvFlags;
let miss_flags = u16[6] flag MissionFlags;
let envi_flags = u16[8] flag EnvironmentFlags;
let level_name = mac_roman_cstr[18; 66] no_try;
let entr_flags = u32[84] flag EntFlags;
let entr_flags = u32[84] flag EntryFlags;
}
}
@ -42,13 +42,13 @@ pub fn read_old(b: &[u8]) -> ResultS<Info>
let minf = read(b)?;
let mut entr_flags = if minf.entr_flags.is_empty() {
EntFlags::SOLO
EntryFlags::SOLO
} else {
minf.entr_flags
};
if entr_flags.intersects(EntFlags::SOLO | EntFlags::CARNAGE) {
entr_flags.insert(EntFlags::CO_OP)
if entr_flags.intersects(EntryFlags::SOLO | EntryFlags::CARNAGE) {
entr_flags.insert(EntryFlags::CO_OP)
}
Ok(Info{entr_flags, ..minf})
@ -61,9 +61,9 @@ impl Default for Info
Self{texture_id: 0,
physics_id: 1,
skypict_id: 0,
miss_flags: MsnFlags::empty(),
envi_flags: EnvFlags::empty(),
entr_flags: EntFlags::SOLO,
miss_flags: MissionFlags::empty(),
envi_flags: EnvironmentFlags::empty(),
entr_flags: EntryFlags::SOLO,
level_name: "Map".to_string()}
}
}
@ -76,16 +76,16 @@ pub struct Info
pub texture_id: u16,
pub physics_id: u16,
pub skypict_id: u16,
pub miss_flags: MsnFlags,
pub envi_flags: EnvFlags,
pub entr_flags: EntFlags,
pub miss_flags: MissionFlags,
pub envi_flags: EnvironmentFlags,
pub entr_flags: EntryFlags,
pub level_name: String,
}
bitflags! {
/// Static environment flags.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
pub struct EnvFlags: u16
pub struct EnvironmentFlags: u16
{
const VACUUM = 1;
const MAGNETIC = 1 << 1;
@ -104,7 +104,7 @@ bitflags! {
bitflags! {
/// Static entry point flags.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
pub struct EntFlags: u32
pub struct EntryFlags: u32
{
const SOLO = 1;
const CO_OP = 1 << 1;
@ -120,7 +120,7 @@ bitflags! {
bitflags! {
/// Static mission flags.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
pub struct MsnFlags: u16
pub struct MissionFlags: u16
{
const EXTERMINATION = 1;
const EXPLORATION = 1 << 1;

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -42,7 +42,7 @@ pub fn read(b: &[u8]) -> ResultS<(Polygon, usize)>
}
let poly = read_poly_inter(b)?;
let ptype = PolyType::new(ptype, pdata)?;
let ptype = PolygonType::new(ptype, pdata)?;
Ok((Polygon{ptype, ori_flr, ori_cei, med_ind, med_ctl, snd_ind, snd_amb,
snd_rnd, ..poly}, 128))
@ -59,73 +59,73 @@ pub fn read_old(b: &[u8]) -> ResultS<(Polygon, usize)>
}
let poly = read_poly_inter(b)?;
let ptype = PolyType::new_old(ptype, pdata)?;
let ptype = PolygonType::new_old(ptype, pdata)?;
Ok((Polygon{ptype, ..poly}, 128))
}
impl PolyType
impl PolygonType
{
/// Creates a `PolyType` from a `n`/`pdata` pair.
/// Creates a `PolygonType` from a `n`/`pdata` pair.
pub fn new(n: u16, pdata: u16) -> Result<Self, ReprError>
{
match n {
0 => Ok(PolyType::Normal),
1 => Ok(PolyType::ImpassItem),
2 => Ok(PolyType::ImpassMons),
3 => Ok(PolyType::Hill),
4 => Ok(PolyType::Base),
5 => Ok(PolyType::Platform(pdata)),
6 => Ok(PolyType::TrigLightOn(pdata)),
7 => Ok(PolyType::TrigPlatOn(pdata)),
8 => Ok(PolyType::TrigLightOff(pdata)),
9 => Ok(PolyType::TrigPlatOff(pdata)),
10 => Ok(PolyType::Teleporter(pdata)),
11 => Ok(PolyType::ZoneBorder),
12 => Ok(PolyType::Goal),
13 => Ok(PolyType::TrigMonsVis),
14 => Ok(PolyType::TrigMonsInv),
15 => Ok(PolyType::TrigMonsDual),
16 => Ok(PolyType::TrigItems),
17 => Ok(PolyType::MustExplore),
18 => Ok(PolyType::AutoExit),
19 => Ok(PolyType::OuchMinor),
20 => Ok(PolyType::OuchMajor),
21 => Ok(PolyType::Glue),
22 => Ok(PolyType::GlueTrigger(pdata)),
23 => Ok(PolyType::GlueSuper),
0 => Ok(PolygonType::Normal),
1 => Ok(PolygonType::ImpassItem),
2 => Ok(PolygonType::ImpassMons),
3 => Ok(PolygonType::Hill),
4 => Ok(PolygonType::Base),
5 => Ok(PolygonType::Platform(pdata)),
6 => Ok(PolygonType::TrigLightOn(pdata)),
7 => Ok(PolygonType::TrigPlatOn(pdata)),
8 => Ok(PolygonType::TrigLightOff(pdata)),
9 => Ok(PolygonType::TrigPlatOff(pdata)),
10 => Ok(PolygonType::Teleporter(pdata)),
11 => Ok(PolygonType::ZoneBorder),
12 => Ok(PolygonType::Goal),
13 => Ok(PolygonType::TrigMonsVis),
14 => Ok(PolygonType::TrigMonsInv),
15 => Ok(PolygonType::TrigMonsDual),
16 => Ok(PolygonType::TrigItems),
17 => Ok(PolygonType::MustExplore),
18 => Ok(PolygonType::AutoExit),
19 => Ok(PolygonType::OuchMinor),
20 => Ok(PolygonType::OuchMajor),
21 => Ok(PolygonType::Glue),
22 => Ok(PolygonType::GlueTrigger(pdata)),
23 => Ok(PolygonType::GlueSuper),
n => Err(ReprError::new(n)),
}
}
/// Creates a `PolyType` from a Marathon 1 compatible `n`/`pdata` pair.
/// Creates a `PolygonType` from a Marathon 1 compatible `n`/`pdata` pair.
fn new_old(n: u16, pdata: u16) -> Result<Self, ReprError>
{
match n {
0 => Ok(PolyType::Normal),
1 => Ok(PolyType::ImpassItem),
2 => Ok(PolyType::ImpassMons),
3 => Ok(PolyType::OuchMinor),
4 => Ok(PolyType::OuchMajor),
5 => Ok(PolyType::Platform(pdata)),
6 => Ok(PolyType::TrigLightOn(pdata)),
7 => Ok(PolyType::TrigPlatOn(pdata)),
8 => Ok(PolyType::TrigLightOff(pdata)),
9 => Ok(PolyType::TrigPlatOff(pdata)),
10 => Ok(PolyType::Teleporter(pdata)),
11 => Ok(PolyType::Glue),
12 => Ok(PolyType::GlueTrigger(pdata)),
13 => Ok(PolyType::GlueSuper),
14 => Ok(PolyType::MustExplore),
15 => Ok(PolyType::AutoExit),
0 => Ok(PolygonType::Normal),
1 => Ok(PolygonType::ImpassItem),
2 => Ok(PolygonType::ImpassMons),
3 => Ok(PolygonType::OuchMinor),
4 => Ok(PolygonType::OuchMajor),
5 => Ok(PolygonType::Platform(pdata)),
6 => Ok(PolygonType::TrigLightOn(pdata)),
7 => Ok(PolygonType::TrigPlatOn(pdata)),
8 => Ok(PolygonType::TrigLightOff(pdata)),
9 => Ok(PolygonType::TrigPlatOff(pdata)),
10 => Ok(PolygonType::Teleporter(pdata)),
11 => Ok(PolygonType::Glue),
12 => Ok(PolygonType::GlueTrigger(pdata)),
13 => Ok(PolygonType::GlueSuper),
14 => Ok(PolygonType::MustExplore),
15 => Ok(PolygonType::AutoExit),
n => Err(ReprError::new(n)),
}
}
}
impl Default for PolyType
impl Default for PolygonType
{
fn default() -> Self {PolyType::Normal}
fn default() -> Self {PolygonType::Normal}
}
/// A polygon segment.
@ -133,7 +133,7 @@ impl Default for PolyType
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct Polygon
{
pub ptype: PolyType,
pub ptype: PolygonType,
pub tex_flr: OptU16,
pub tex_cei: OptU16,
pub hei_flr: Unit,
@ -154,7 +154,7 @@ pub struct Polygon
/// The action type of a `Polygon`.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum PolyType
pub enum PolygonType
{
Normal,
ImpassItem,
@ -185,7 +185,7 @@ pub enum PolyType
bitflags! {
/// Flags for `Polygon`.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
pub struct PolyFlags: u16
pub struct PolygonFlags: u16
{
const DETACHED = 1 << 14;
}

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -75,7 +75,6 @@ bitflags! {
c_enum! {
/// The texture type of a `Side`.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum SideType: u16
{
Full = 0,

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -61,7 +61,6 @@ pub struct Trigger
c_enum! {
/// A bullet shell casing emitted by a weapon.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum CasingType: u16
{
Rifle = 0,

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -99,7 +99,6 @@ bitflags! {
c_enum! {
/// The type of functionality a weapon provides.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum WeaponType: u16
{
Melee = 0,

50
maraiah/meta.rs Normal file
Просмотреть файл

@ -0,0 +1,50 @@
//! Meta-information of this crate.
macro_rules! meta_str {
($($(#[$outer:meta])* $name:ident = $e:expr;)*) => {
$($(#[$outer])* pub const fn $name() -> &'static str {$e})*
pub mod ffi
{
$(
doc_comment! {
concat!("FFI variant of [`",
stringify!($name),
"`]\n\n[`",
stringify!($name),
"`]: ../fn.",
stringify!($name),
".html"),
pub const fn $name() -> crate::ffi::NT {c_str!($e)}
}
)*
}
}
}
meta_str!(
/// The authors of this crate, `:` separated.
authors = env!("CARGO_PKG_AUTHORS");
/// The description of this crate.
description = env!("CARGO_PKG_DESCRIPTION");
/// The home page of this crate.
homepage = env!("CARGO_PKG_HOMEPAGE");
/// The full license text of this crate.
license_text = include_str!("../LICENSE");
/// The name of this crate.
name = env!("CARGO_PKG_NAME");
/// The repository of this crate.
repository = env!("CARGO_PKG_REPOSITORY");
/// The full version of this crate.
version = env!("CARGO_PKG_VERSION");
/// The major version of this crate.
version_major = env!("CARGO_PKG_VERSION_MAJOR");
/// The minor version of this crate.
version_minor = env!("CARGO_PKG_VERSION_MINOR");
/// The patch version of this crate.
version_patch = env!("CARGO_PKG_VERSION_PATCH");
/// The pre-release version of this crate.
version_pre = env!("CARGO_PKG_VERSION_PRE");
);
// EOF

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -57,7 +57,6 @@ pub struct Collection
c_enum! {
/// The type of a collection.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum CollectionType: u16
{
Unused = 0,

Просмотреть файл

Просмотреть файл

@ -71,7 +71,6 @@ pub struct Sequence
c_enum! {
/// The type of or number of views for a sequence.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum ViewType: u16
{
Anim = 1,

Просмотреть файл

Просмотреть файл

@ -89,7 +89,6 @@ bitflags! {
c_enum! {
/// The type of volume this sound has.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum Volume: u16
{
Quiet = 0,

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -8,7 +8,6 @@ impl Default for TransferMode
c_enum! {
/// A rendering style for many things.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug)]
pub enum TransferMode: u16
{
Normal = 0,

Просмотреть файл

@ -1,17 +0,0 @@
[package]
name = "maraiah-leela"
version = "0.1.0"
authors = ["Alison Watson <marrub@greyserv.net>"]
description = "Maraiah testbed program."
edition = "2018"
[dependencies]
clap = "2"
maraiah = {path = "../..", features = ["serde_obj"]}
memmap = "0.7"
serde = "1.0"
serde_yaml = "0.8"
[[bin]]
name = "leela"
path = "main.rs"

Просмотреть файл

@ -1,51 +0,0 @@
//! Meta-information of this crate.
macro_rules! meta_str {
($($(#[$outer:meta])* $name:ident = $cname:ident = $e:expr;)*) => {
$(
$(#[$outer])* pub const $name: &'static str = $e;
)*
pub mod ffi
{
$(
doc_comment! {
concat!("FFI variant of [`",
stringify!($name),
"`]\n\n[`",
stringify!($name),
"`]: ../constant.",
stringify!($name),
".html"),
pub const $cname: crate::ffi::NT = c_str!($e);
}
)*
}
}
}
meta_str!(
/// The authors of this crate, `:` separated.
AUTHORS = AUTHORS_C = env!("CARGO_PKG_AUTHORS");
/// The description of this crate.
DESCRIPTION = DESCRIPTION_C = env!("CARGO_PKG_DESCRIPTION");
/// The home page of this crate.
HOMEPAGE = HOMEPAGE_C = env!("CARGO_PKG_HOMEPAGE");
/// The full license text of this crate.
LICENSE_TEXT = LICENSE_TEXT_C = include_str!("../LICENSE");
/// The name of this crate.
NAME = NAME_C = env!("CARGO_PKG_NAME");
/// The repository of this crate.
REPOSITORY = REPOSITORY_C = env!("CARGO_PKG_REPOSITORY");
/// The full version of this crate.
VERSION = VERSION_C = env!("CARGO_PKG_VERSION");
/// The major version of this crate.
VERSION_MAJOR = VERSION_MAJOR_C = env!("CARGO_PKG_VERSION_MAJOR");
/// The minor version of this crate.
VERSION_MINOR = VERSION_MINOR_C = env!("CARGO_PKG_VERSION_MINOR");
/// The patch version of this crate.
VERSION_PATCH = VERSION_PATCH_C = env!("CARGO_PKG_VERSION_PATCH");
/// The pre-release version of this crate.
VERSION_PRE = VERSION_PRE_C = env!("CARGO_PKG_VERSION_PRE");
);
// EOF

Двоичные данные
tests/data/m2/Map Normal file

Двоичный файл не отображается.

Просмотреть файл

Просмотреть файл

@ -2,8 +2,8 @@ map::minf::Info{
texture_id: 0,
physics_id: 1,
skypict_id: 1,
miss_flags: map::minf::MsnFlags::REPAIR,
envi_flags: map::minf::EnvFlags::empty(),
entr_flags: map::minf::EntFlags::SOLO | map::minf::EntFlags::CO_OP,
miss_flags: map::minf::MissionFlags::REPAIR,
envi_flags: map::minf::EnvironmentFlags::empty(),
entr_flags: map::minf::EntryFlags::SOLO | map::minf::EntryFlags::CO_OP,
level_name: "Waterloo Waterpark".to_owned()
}

Двоичные данные
tests/data/map/testmap.in Normal file

Двоичный файл не отображается.

2185
tests/data/map/testmap.out Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -36,7 +36,7 @@ fn defl_alice_2()
fn defl_shapes()
{
const INPUT: &[u8] = include_bytes!("data/defl/Shapes.in");
const OUTPUT: &[u8] = include_bytes!("data/defl/Shapes.out");
const OUTPUT: &[u8] = include_bytes!("data/m2/Shapes");
defl_gzip(INPUT, OUTPUT);
}

Просмотреть файл

@ -51,25 +51,65 @@ fn read_term_must_process()
}
}
#[test]
fn map_m2()
{
let inp = include_bytes!("data/m2/Map");
let mut rd = std::io::BufReader::new(&inp[..]);
let mp = map::head::read(&mut rd).unwrap();
let en = map::entr::read_all(&mp).unwrap();
assert!(map::data::read_all(mp.head(), &en).is_ok());
}
#[test]
#[ignore]
fn map_full_check()
{
use maraiah::{bin::OptU16,
map::{data::*, lins::*, lite::*, ltfn::*, minf::*, objs::*,
plac::*, pnts::*, poly::*},
xfer::TransferMode};
use std::collections::BTreeMap;
let inp = include_bytes!("data/map/testmap.in");
let mut rd = std::io::BufReader::new(&inp[..]);
let mp = map::head::read(&mut rd).unwrap();
let en = map::entr::read_all(&mp).unwrap();
let ed = map::data::read_all(mp.head(), &en).unwrap();
let mut out = BTreeMap::new();
out.insert(0, include!("data/map/testmap.out"));
assert_eq!(out, ed);
}
#[test]
fn map_must_not_process()
{
for inp in &RANDOM {
map::minf::read(inp).err().unwrap();
map::minf::read_old(inp).err().unwrap();
bin::rd_array(inp, map::fxpx::read).err().unwrap();
bin::rd_array(inp, map::lins::read).err().unwrap();
bin::rd_array(inp, map::lite::read).err().unwrap();
bin::rd_array(inp, map::lite::read_old).err().unwrap();
bin::rd_array(inp, map::medi::read).err().unwrap();
bin::rd_array(inp, map::mnpx::read).err().unwrap();
bin::rd_array(inp, map::note::read).err().unwrap();
bin::rd_array(inp, map::objs::read).err().unwrap();
bin::rd_array(inp, map::plat::read).err().unwrap();
bin::rd_array(inp, map::poly::read).err().unwrap();
bin::rd_array(inp, map::poly::read_old).err().unwrap();
bin::rd_array(inp, map::prpx::read).err().unwrap();
bin::rd_array(inp, map::sids::read).err().unwrap();
bin::rd_array(inp, map::sids::read_old).err().unwrap();
bin::rd_array(inp, map::term::read).err().unwrap();
bin::rd_array(inp, map::trmg::read).err().unwrap();
bin::rd_array(inp, map::lite::read_old).err().unwrap();
bin::rd_array(inp, map::poly::read_old).err().unwrap();
bin::rd_array(inp, map::sids::read_old).err().unwrap();
bin::rd_array(inp, map::wppx::read).err().unwrap();
map::minf::read(inp).err().unwrap();
map::minf::read_old(inp).err().unwrap();
}
}
@ -82,27 +122,9 @@ fn map_must_not_panic()
drop(bin::rd_array(inp, map::epnt::read));
drop(bin::rd_array(inp, map::iidx::read));
drop(bin::rd_array(inp, map::plac::read));
drop(bin::rd_array(inp, map::pxpx::read));
drop(bin::rd_array(inp, map::trmf::read));
}
}
#[test]
fn phy_must_not_process()
{
for inp in &RANDOM {
bin::rd_array(inp, map::fxpx::read).err().unwrap();
bin::rd_array(inp, map::mnpx::read).err().unwrap();
bin::rd_array(inp, map::prpx::read).err().unwrap();
bin::rd_array(inp, map::wppx::read).err().unwrap();
}
}
#[test]
fn phy_must_not_panic()
{
for inp in &RANDOM {
drop(bin::rd_array(inp, map::pxpx::read));
}
}
// EOF

Просмотреть файл

@ -1,4 +1,4 @@
use maraiah::{image::{Color8, pict}};
use maraiah::image::{pict, Color8};
include!("data/rand.rs");

Просмотреть файл

Просмотреть файл

@ -5,12 +5,11 @@ edition = "2018"
build = "build.rs"
[dependencies]
maraiah = {path = "../.."}
memmap = "0.7"
maraiah = {path = ".."}
[build-dependencies]
cmake = "0.1"
maraiah = {path = "../.."}
maraiah = {path = ".."}
rust_qt_binding_generator = "0.3"
[[bin]]

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 805 B

После

Ширина:  |  Высота:  |  Размер: 805 B

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 2.1 KiB

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 19 KiB

После

Ширина:  |  Высота:  |  Размер: 19 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 761 B

После

Ширина:  |  Высота:  |  Размер: 761 B

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше