Improved performance and compilation speed for debug builds

Former-commit-id: 5d8b1c27a8a2ebfe63797969ee2aba7452a09dd3
This commit is contained in:
Joshua Barretto 2019-05-12 18:43:55 +01:00
parent d8f6025b68
commit a8981378bf
4 changed files with 20 additions and 12 deletions

View File

@ -10,6 +10,10 @@ members = [
]
[profile.dev]
opt-level = 2
overflow-checks = false
[profile.release]
debug = true
codegen-units = 1
lto = true

View File

@ -54,17 +54,17 @@ impl<'a, V: ReadVol, F: RayUntil<V::Vox>> Ray<'a, V, F> {
pos = self.from + dir * dist;
ipos = pos.map(|e| e.floor() as i32);
// Allow one iteration above max
if dist > max {
break;
}
match self.vol.get(ipos).map(|vox| (vox, (self.until)(vox))) {
Ok((vox, true)) => return (dist, Ok(Some(vox))),
Err(err) if !self.ignore_error => return (dist, Err(err)),
_ => {}
}
// Allow one iteration above max
if dist > max {
break;
}
let deltas =
(dir.map(|e| if e < 0.0 { 0.0 } else { 1.0 }) - pos.map(|e| e.abs().fract())) / dir;

View File

@ -195,11 +195,15 @@ fn handle_pet(server: &mut Server, entity: EcsEntity, args: String, action: &Cha
.read_component_cloned::<comp::phys::Pos>(entity)
{
Some(pos) => {
server.create_npc(comp::Character::random())
.with(comp::Control::default())
.with(comp::Agent::Pet{ target: entity, offset: Vec2::zero() })
.with(pos)
.build();
let mut current = entity;
for _ in 0..1 {
current = server.create_npc(comp::Character::random())
.with(comp::Control::default())
.with(comp::Agent::Pet{ target: current, offset: Vec2::zero() })
.with(pos)
.build();
}
server.clients.notify(entity, ServerMsg::Chat("Pet spawned!".to_owned()));
},
None => server.clients.notify(entity, ServerMsg::Chat("You have no position!".to_owned())),

View File

@ -29,12 +29,12 @@ impl Animation for IdleAnimation {
let wave_dip = (wave_slow.abs() - 0.5).abs();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 5.0)
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 5.0)
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()