t merge Merge branch 'master' of gitlab.com:veloren/veloren into sharp/jungle

This commit is contained in:
Joshua Yanovski 2019-08-19 19:21:05 +02:00
commit 97eaeddd78
12 changed files with 9 additions and 56 deletions

View File

@ -1,3 +1,5 @@
#![deny(unsafe_code)]
use client::{Client, Event};
use common::{clock::Clock, comp};
use log::{error, info};

View File

@ -1,3 +1,4 @@
#![deny(unsafe_code)]
#![feature(label_break_value, duration_float, euclidean_division)]
pub mod error;

View File

@ -1,3 +1,4 @@
#![deny(unsafe_code)]
#![type_length_limit = "1664759"]
#![feature(
euclidean_division,

View File

@ -122,40 +122,6 @@ impl ReadVol for Chonk {
}
}
}
#[inline(always)]
unsafe fn get_unchecked(&self, pos: Vec3<i32>) -> &Block {
if pos.z < self.z_offset {
// Below the terrain
&self.below
} else if pos.z >= self.z_offset + SUB_CHUNK_HEIGHT as i32 * self.sub_chunks.len() as i32 {
// Above the terrain
&self.above
} else {
// Within the terrain
let sub_chunk_idx = self.sub_chunk_idx(pos.z);
match &self.sub_chunks[sub_chunk_idx] {
// Can't fail
SubChunk::Homogeneous(block) => block,
SubChunk::Hash(cblock, map) => {
let rpos = pos
- Vec3::unit_z()
* (self.z_offset + sub_chunk_idx as i32 * SUB_CHUNK_HEIGHT as i32);
map.get(&rpos.map(|e| e as u8)).unwrap_or(cblock)
}
SubChunk::Heterogeneous(chunk) => {
let rpos = pos
- Vec3::unit_z()
* (self.z_offset + sub_chunk_idx as i32 * SUB_CHUNK_HEIGHT as i32);
chunk.get_unchecked(rpos)
}
}
}
}
}
impl WriteVol for Chonk {

View File

@ -72,10 +72,6 @@ pub trait ReadVol: BaseVol {
/// Get a reference to the voxel at the provided position in the volume.
fn get(&self, pos: Vec3<i32>) -> Result<&Self::Vox, Self::Err>;
unsafe fn get_unchecked(&self, pos: Vec3<i32>) -> &Self::Vox {
self.get(pos).unwrap()
}
fn ray(
&self,
from: Vec3<f32>,

View File

@ -60,11 +60,6 @@ impl<V: Vox, S: VolSize, M> ReadVol for Chunk<V, S, M> {
.and_then(|idx| self.vox.get(idx))
.ok_or(ChunkErr::OutOfBounds)
}
#[inline(always)]
unsafe fn get_unchecked(&self, pos: Vec3<i32>) -> &V {
self.vox.get_unchecked(Self::idx_for_unchecked(pos))
}
}
impl<V: Vox, S: VolSize, M> WriteVol for Chunk<V, S, M> {

View File

@ -57,12 +57,6 @@ impl<V: Vox, M> ReadVol for Dyna<V, M> {
.and_then(|idx| self.vox.get(idx))
.ok_or(DynaErr::OutOfBounds)
}
#[inline(always)]
unsafe fn get_unchecked(&self, pos: Vec3<i32>) -> &V {
self.vox
.get_unchecked(Self::idx_for_unchecked(self.sz, pos))
}
}
impl<V: Vox, M> WriteVol for Dyna<V, M> {

View File

@ -60,13 +60,6 @@ impl<V: BaseVol + ReadVol + Debug, S: VolSize> ReadVol for VolMap2d<V, S> {
chunk.get(co).map_err(VolMap2dErr::ChunkErr)
})
}
#[inline(always)]
unsafe fn get_unchecked(&self, pos: Vec3<i32>) -> &V::Vox {
let ck = Self::chunk_key(pos);
let co = Self::chunk_offs(pos);
self.chunks.get(&ck).unwrap().get_unchecked(co)
}
}
// TODO: This actually breaks the API: samples are supposed to have an offset of zero!

View File

@ -1,3 +1,5 @@
#![deny(unsafe_code)]
use common::clock::Clock;
use heaptrack::track_mem;
use log::info;

View File

@ -1,3 +1,4 @@
#![deny(unsafe_code)]
#![feature(drain_filter, bind_by_move_pattern_guards)]
pub mod auth_provider;

View File

@ -1,3 +1,4 @@
#![deny(unsafe_code)]
#![feature(duration_float, drain_filter)]
#![recursion_limit = "2048"]

View File

@ -1,3 +1,4 @@
#![deny(unsafe_code)]
#![feature(euclidean_division, bind_by_move_pattern_guards, option_flattening)]
mod all;