changed string to hashmap/record for abilities
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
|
||||
use serde_json::json;
|
||||
@@ -241,7 +242,7 @@ fn search(index: i64) -> SearchResult {
|
||||
name: row.read::<&str, _>("name").to_string(),
|
||||
types: serde_json::from_str(row.read::<&str, _>("types")).unwrap_or(vec![0]),
|
||||
thumbnail: row.read::<&str, _>("thumbnail").to_string(),
|
||||
abilities: row.read::<&str, _>("abilities").to_string(),
|
||||
abilities: serde_json::from_str(row.read::<&str, _>("abilities")).unwrap_or(HashMap::new()),
|
||||
hp: row.read::<i64, _>("hp"),
|
||||
attack: row.read::<i64, _>("attack"),
|
||||
defense: row.read::<i64, _>("defense"),
|
||||
@@ -257,7 +258,7 @@ fn search(index: i64) -> SearchResult {
|
||||
name: "Missigno".to_string(),
|
||||
types: vec![],
|
||||
thumbnail: "".to_string(),
|
||||
abilities: "{}".to_string(),
|
||||
abilities: HashMap::new(),
|
||||
hp: 0,
|
||||
attack: 0,
|
||||
defense: 0,
|
||||
|
||||
Reference in New Issue
Block a user