This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user