A bunch of fixes and improvements
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-09-17 09:38:02 +02:00
parent 7bcfd92d45
commit a4fd112a07
15 changed files with 179 additions and 100 deletions

View File

@@ -41,7 +41,7 @@ pub mod tests {
pub fn build() -> AbilityLibrary {
let mut lib = AbilityLibrary::new(1);
lib.add(
&StringKey::new("test_ability"),
&StringKey::new("test_ability".into()),
Ability::new(&"test_ability".into(), &"test_ability".into(), Vec::new()),
);
// Drops borrow as mut

View File

@@ -61,7 +61,7 @@ pub mod tests {
let m = build_move();
// Borrow as mut so we can insert
let w = &mut lib;
w.add(&StringKey::new("foo"), m);
w.add(&StringKey::new("foo".into()), m);
// Drops borrow as mut
lib

View File

@@ -1,4 +1,4 @@
use std::sync::Arc;
use std::sync::{Arc, LazyLock};
use hashbrown::{HashMap, HashSet};
@@ -29,11 +29,11 @@ pub struct Species {
}
/// A cached String Key to get the default form.
static DEFAULT_KEY: conquer_once::OnceCell<StringKey> = conquer_once::OnceCell::uninit();
static DEFAULT_KEY: LazyLock<StringKey> = LazyLock::new(|| StringKey::new("default"));
/// Gets the StringKey for "default". Initialises it if it does not exist.
fn get_default_key() -> StringKey {
DEFAULT_KEY.get_or_init(|| StringKey::new("default")).clone()
DEFAULT_KEY.clone()
}
impl Species {