summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-02-05 23:58:15 +0100
committertroido <troido@protonmail.com>2020-02-05 23:58:15 +0100
commit7a4de27a97dc1e3cc2e517d96683e3c4ba9f7508 (patch)
treedc1aa5dff6ba5ebe958335daade2ecd937bf0fa1 /src/main.rs
parent323cd679cd29a8475c3b7486ce54ecd37620dbea (diff)
parse assemblages from json
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index f5d2394..524d70f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,7 +5,6 @@ use std::time::Duration;
use std::path::Path;
use std::collections::HashMap;
-use serde_json::json;
mod server;
mod gameserver;
@@ -21,7 +20,6 @@ mod pos;
mod assemblage;
// mod load;
mod compwrapper;
-mod template;
use self::gameserver::GameServer;
use self::server::unixserver::UnixServer;
@@ -29,8 +27,8 @@ use self::server::tcpserver::TcpServer;
use self::server::Server;
use self::assemblages::{Wall, Grass};
use self::room::Room;
-use self::template::{Template, CompParam};
use self::util::ToJson;
+use self::compwrapper::{Parameter, Template, CompParam, ComponentType};
@@ -68,10 +66,10 @@ fn gen_room<'a, 'b>(width: i32, height: i32) -> Room<'a, 'b> {
let wall = Template{
arguments: Vec::new(),
components: vec![
- ("Blocking".to_string(), HashMap::new()),
- ("Visible".to_string(), hashmap!(
- "sprite".to_string() => CompParam::Constant(json!("wall")),
- "height".to_string() => CompParam::Constant(json!(1))
+ (ComponentType::from_str("Blocking").unwrap(), HashMap::new()),
+ (ComponentType::from_str("Visible").unwrap(), hashmap!(
+ "sprite".to_string() => CompParam::Constant(Parameter::String("wall".to_string())),
+ "height".to_string() => CompParam::Constant(Parameter::Float(1.0))
))
]
}.instantiate(Vec::new(), HashMap::new()).unwrap();