rust/hedgewars-server/src/server/demo.rs
changeset 15570 d524b7450576
parent 15547 863059f61793
child 15576 3be9c98ae190
equal deleted inserted replaced
15569:4b2f3228f13b 15570:d524b7450576
    16     fn save(&self, file: String) -> io::Result<()> {
    16     fn save(&self, file: String) -> io::Result<()> {
    17         Ok(unimplemented!())
    17         Ok(unimplemented!())
    18     }
    18     }
    19 
    19 
    20     fn load(file: String) -> io::Result<Self> {
    20     fn load(file: String) -> io::Result<Self> {
       
    21         let value = super::haskell::parse(&[]);
    21         Ok(unimplemented!())
    22         Ok(unimplemented!())
    22     }
    23     }
    23 
    24 
    24     fn load_hwd(file: String) -> io::Result<Self> {
    25     fn load_hwd(file: String) -> io::Result<Self> {
    25         let datum = fs::File::open(file)?;
    26         let datum = fs::File::open(file)?;
    58         fn get_script_name(arg: &str) -> io::Result<String> {
    59         fn get_script_name(arg: &str) -> io::Result<String> {
    59             const PREFIX: &str = "Scripts/Multiplayer/";
    60             const PREFIX: &str = "Scripts/Multiplayer/";
    60             const SUFFIX: &str = ".lua";
    61             const SUFFIX: &str = ".lua";
    61             if arg.starts_with(PREFIX) && arg.ends_with(SUFFIX) {
    62             if arg.starts_with(PREFIX) && arg.ends_with(SUFFIX) {
    62                 let script = arg[PREFIX.len()..arg.len() - SUFFIX.len()].to_string();
    63                 let script = arg[PREFIX.len()..arg.len() - SUFFIX.len()].to_string();
    63                 script.replace('_', " ");
    64                 Ok(script.replace('_', " "))
    64                 Ok(script)
       
    65             } else {
    65             } else {
    66                 error("Script is not multiplayer")
    66                 error("Script is not multiplayer")
    67             }
    67             }
    68         }
    68         }
    69 
    69