aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2019-12-20 18:04:24 +0100
committerDaniel Schadt <kingdread@gmx.de>2019-12-20 18:04:24 +0100
commit9f4a4eaa06f3d0136de9088c0e60a0c077248c91 (patch)
tree4ab0e0c9f5910643ac6404c390e6aa6fad4ca470 /src/main.rs
parent087580b3c269dbc5b2298ff6f4590f010279d339 (diff)
downloadkondou-9f4a4eaa06f3d0136de9088c0e60a0c077248c91.tar.gz
kondou-9f4a4eaa06f3d0136de9088c0e60a0c077248c91.tar.bz2
kondou-9f4a4eaa06f3d0136de9088c0e60a0c077248c91.zip
remove hard coded palette IDs
Now that the API actually returns the proper palette IDs, we can use those values instead of relying on the hard coded values. This also gets rid of the make_table script that was mostly hackish anyway, and the lazy static HashMap.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs
index 395e683..47ccabd 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -10,8 +10,6 @@ extern crate reqwest;
extern crate rusttype;
extern crate termcolor;
extern crate xdg;
-#[macro_use]
-extern crate lazy_static;
use std::error::Error as StdError;
use std::fmt;
@@ -37,7 +35,7 @@ mod render;
use clap::{App, Arg, ArgMatches};
use api::{Api, Profession, Skill};
-use bt::{BuildTemplate, ExtraData, Legend, TraitChoice, Traitline};
+use bt::{BuildTemplate, ExtraData, Legend, TraitChoice, Traitline, CODE_REVENANT};
use render::RenderError;
/// The name of this application.
@@ -182,10 +180,6 @@ fn run_searching(api: &mut Api, matches: &ArgMatches) -> MainResult<BuildTemplat
.expect("clap handles missing argument");
let profession = find_profession(api, requested_profession)?;
- let prof_enum = profession
- .name
- .parse()
- .expect("Profession object has unparseable name");
let legends = matches
.values_of("legend")
@@ -196,7 +190,7 @@ fn run_searching(api: &mut Api, matches: &ArgMatches) -> MainResult<BuildTemplat
.map(Result::unwrap)
.collect::<Vec<_>>();
- let extra_data = if prof_enum == bt::Profession::Revenant {
+ let extra_data = if profession.code == CODE_REVENANT {
let mut array_legends = [Legend::None; 4];
for (i, l) in legends.iter().enumerate() {
array_legends[i] = *l;
@@ -206,7 +200,7 @@ fn run_searching(api: &mut Api, matches: &ArgMatches) -> MainResult<BuildTemplat
ExtraData::None
};
- let skills = if prof_enum != bt::Profession::Revenant {
+ let skills = if profession.code != CODE_REVENANT {
matches
.values_of("skill")
.map(Iterator::collect::<Vec<_>>)
@@ -240,7 +234,7 @@ fn run_searching(api: &mut Api, matches: &ArgMatches) -> MainResult<BuildTemplat
"got too many traitlines"
);
- let build = BuildTemplate::new(prof_enum, &skills, &traitlines, extra_data)
+ let build = BuildTemplate::new(profession, &skills, &traitlines, extra_data)
.expect("BuildTemplate could not be constructed");
Ok(build)
@@ -368,7 +362,7 @@ fn run() -> MainResult<()> {
if !matches.is_present("quiet") {
println!("Image saved in {}", filename);
}
- },
+ }
Err(RenderError::EmptyBuild) => (),
Err(err) => {
eprintln!("Image could not be rendered:");