aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index b59d587..ab93eb5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -16,16 +16,23 @@ use pancurses::{
Input,
noecho
};
+use std::env;
use state::State;
use world::{Dungeon};
+fn get_player_name() -> String {
+ match env::var_os("USER") {
+ Some(val) => val.into_string().unwrap(),
+ None => String::from("Kshar")
+ }
+}
fn main() {
let window = initscr();
let mut state = State::new(
Player::new(
- "Kshar".to_string(),
+ get_player_name(),
"Warrior".to_string(),
30,
10,