summaryrefslogtreecommitdiff
path: root/src/map.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2019-06-16 12:38:05 -0500
committertom barrett <spalf0@gmail.com>2019-06-16 12:38:05 -0500
commit6162da14c62b1f2e23428dac40ad608bd9bb5e7d (patch)
tree3bb32148741333e9f1b1cb70866933f56489951d /src/map.rs
parent8bb97d08ce435b207419e8c3502ab1fb76a21d2f (diff)
parent02c34c4f2537386fb1087c1fb3528f96011a54e0 (diff)
Merge branch 'master' into feature/tiles
Diffstat (limited to 'src/map.rs')
-rw-r--r--src/map.rs35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/map.rs b/src/map.rs
index db79deb..ed90f1a 100644
--- a/src/map.rs
+++ b/src/map.rs
@@ -2,24 +2,6 @@ use ggez::filesystem::File;
use std::io::BufReader;
use xml::reader::{EventReader, XmlEvent};
-pub struct Layer {
- pub id: usize,
- pub data: Vec<usize>,
-}
-
-impl Layer {
- pub fn new(text: String, id: usize) -> Layer {
- Layer {
- id,
- data: text
- .replace("\n", "")
- .split(',')
- .map(|s| s.parse().unwrap())
- .collect(),
- }
- }
-}
-
pub struct Map {
pub width: usize,
pub height: usize,
@@ -47,7 +29,7 @@ impl Map {
}
}
} else if let Ok(XmlEvent::Characters(text)) = e {
- layers.push(Layer::new(text, layers.len() + 1));
+ layers.push(Layer::new(text));
}
}
@@ -59,3 +41,18 @@ impl Map {
}
}
+pub struct Layer {
+ pub data: Vec<usize>,
+}
+
+impl Layer {
+ pub fn new(text: String) -> Layer {
+ Layer {
+ data: text
+ .replace("\n", "")
+ .split(',')
+ .map(|s| s.parse().unwrap())
+ .collect(),
+ }
+ }
+}