Large amounts of work on Rune
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2024-05-08 15:46:09 +02:00
parent 4bc76b0ee4
commit 4ec07ca049
43 changed files with 979 additions and 397 deletions

View File

@@ -38,14 +38,10 @@ impl NatureLibraryImpl {
impl NatureLibrary for NatureLibraryImpl {
/// Adds a new nature with name to the library.
fn load_nature(&self, name: StringKey, nature: Arc<dyn Nature>) {
self.map.write().insert(name, nature);
}
fn load_nature(&self, name: StringKey, nature: Arc<dyn Nature>) { self.map.write().insert(name, nature); }
/// Gets a nature by name.
fn get_nature(&self, key: &StringKey) -> Option<Arc<dyn Nature>> {
self.map.read().get(key).cloned()
}
fn get_nature(&self, key: &StringKey) -> Option<Arc<dyn Nature>> { self.map.read().get(key).cloned() }
fn get_random_nature(&self, rand: &mut Random) -> Result<Arc<dyn Nature>> {
let map = self.map.read();
@@ -80,7 +76,7 @@ impl NatureLibrary for NatureLibraryImpl {
pub mod tests {
use super::*;
use crate::static_data::statistics::Statistic;
use crate::static_data::{NatureImpl, NatureLibrary, NatureLibraryImpl};
use crate::static_data::NatureImpl;
pub fn build() -> NatureLibraryImpl {
let lib = NatureLibraryImpl::new(2);