only have 1 Fn passed to tick fn

This commit is contained in:
Marcel Märtens 2021-04-20 01:49:45 +02:00
parent 485a477503
commit 7348e399e0
3 changed files with 11 additions and 7 deletions

View File

@ -1419,8 +1419,14 @@ impl Client {
}
// 4) Tick the client's LocalState
self.state
.tick(dt, add_local_systems, add_foreign_systems, true);
self.state.tick(
dt,
|dispatch_builder| {
add_local_systems(dispatch_builder);
add_foreign_systems(dispatch_builder);
},
true,
);
// TODO: avoid emitting these in the first place
self.state
.ecs()

View File

@ -508,8 +508,7 @@ impl State {
pub fn tick(
&mut self,
dt: Duration,
add_local_systems: impl Fn(&mut DispatcherBuilder),
add_foreign_systems: impl Fn(&mut DispatcherBuilder),
add_systems: impl Fn(&mut DispatcherBuilder),
update_terrain_and_regions: bool,
) {
span!(_guard, "tick", "State::tick");
@ -532,8 +531,7 @@ impl State {
let mut dispatch_builder =
DispatcherBuilder::new().with_pool(Arc::clone(&self.thread_pool));
// TODO: Consider alternative ways to do this
add_local_systems(&mut dispatch_builder);
add_foreign_systems(&mut dispatch_builder);
add_systems(&mut dispatch_builder);
// This dispatches all the systems in parallel.
let mut dispatcher = dispatch_builder.build();
drop(guard);

View File

@ -517,8 +517,8 @@ impl Server {
// in sys/terrain.rs
self.state.tick(
dt,
add_local_systems,
|dispatcher_builder| {
add_local_systems(dispatcher_builder);
sys::msg::add_server_systems(dispatcher_builder);
sys::add_server_systems(dispatcher_builder);
#[cfg(feature = "worldgen")]