diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 9fd7963..20e4bcf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use dmn::dice; -use dmn::random_tables::RandomTables; +use dmn::random_tables::RANDOM_TABLES; use dmn::rules::ability_scores::AbilityScore; use dmn::rules::classes::CLASSES; use dmn::rules::npcs::Npc; @@ -12,15 +12,14 @@ fn main() { env_logger::init(); let matches = cli::cli().get_matches(); - let random_tables = RandomTables::new().expect("Failed to load random tables."); match matches.subcommand() { Some(("random", sub_matches)) => { let random_command = sub_matches.subcommand().unwrap(); match random_command { ("henchman", henchman_matches) => { - let class_name = random_tables.roll_table("henchman_class").to_string(); - let race_name = random_tables.roll_table("henchman_race").to_string(); + let class_name = RANDOM_TABLES.roll_table("henchman_class").to_string(); + let race_name = RANDOM_TABLES.roll_table("henchman_race").to_string(); // HACK: Need a proper way to do lookups, shouldn't rely on // downcasing the class name. This whole situation is really // indicative of the need for an architectural improvement. @@ -36,7 +35,7 @@ fn main() { }); let mut npc = Npc::new( - Some(random_tables.roll_table("npc_alignment")), + Some(RANDOM_TABLES.roll_table("npc_alignment")), Some(race_ref), Some(class_ref), None, @@ -89,7 +88,7 @@ fn main() { }; } ("magic", _) => { - let magic = random_tables.roll_table("ua_magic"); + let magic = RANDOM_TABLES.roll_table("ua_magic"); println!("{}", magic); } _ => unreachable!(), @@ -104,7 +103,7 @@ fn main() { } Some(("table", sub_matches)) => { let table_name = sub_matches.get_one::<String>("TABLE").expect("required"); - let output_text = random_tables.roll_table(table_name); + let output_text = RANDOM_TABLES.roll_table(table_name); println!("{}", output_text) } _ => unreachable!(), |